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

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...