Splunk Search

how to deal with NA values in results in splunk?

m_vivek
Path Finder

My splunk search is something like this

index=pqr host=xyz* NOT TYPE="*ABCDE*" | fields X, Y |timechart limit=0 span=10m count, avg(X) by Y | r " input = data    . . . calculations . . .  output =mydataframe"  

the results i see in splunk after the search resembles this

alt text
I want to go from above results in above picture to the ones in the picture below
alt text

In R to achieve the data transformation from picture one to picture two, all I do is

mydataframe<-mydataframe[complete.cases(mydataframe), ] 

The above does nothing but a subset on all rows of the original dataframe ignoring completely all rows that have atleast one NA in it , leaving me with just the rows that don't have any NA present in them.

How do I achieve this transformation from first picture to the second using splunk processing language?

0 Karma
1 Solution

gcato
Contributor

You can add a where or search clause to filter out fields with NA values. For example

... search output ...| where C!="NA" OR C1!="NA" OR ... and so on 

View solution in original post

ppablo
Retired

Hi @m_vivek

I noticed you upvoted both Answers, but didn't accept either one. If a user has answered your question (any of your questions, not just this one), don't forget to officially accept it by clicking "Accept" directly below the answer. If there is more than one answer, choose the one that best answered your question. Otherwise, the post will just appear as unresolved when other users are searching for solutions to similar issues. Thanks!

gcato
Contributor

You can add a where or search clause to filter out fields with NA values. For example

... search output ...| where C!="NA" OR C1!="NA" OR ... and so on 

bmacias84
Champion

This can be accomplished with the fillnull command.

http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/Fillnull

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...