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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...