All Apps and Add-ons

How to include completely missing fields in results

acidkewpie
Path Finder

Hi,

I'm looking at charting the most common file types, based on a string in a log of "..., http_path=/a/b/c/blah.gif, next-field=..." for example. I've extracted the "gif" field easily enough, and so I can trivially see all file types. BUT how do I cover the case of there being no extension? e.g. "..., http_path=/a/b/app, next-field=..."? These web app locations are the significant majority of the requests, and I'd really like to have a "No Ext" chunk on my pie chart. How can I do this?

If I go back to where the log is generated, then I can hack out the extension there, make a new field, like http_ext and leave it empty, but that doesn't seem like the right thing to do.

Cheers

Chris

0 Karma
1 Solution

yannK
Splunk Employee
Splunk Employee

Do your extractions first, then for each event (before using stats functions), replace the fields that are null by a text value.

example for the field myfield;


| eval myfield=if(isnull(myfield),"missing",myfield)

View solution in original post

yannK
Splunk Employee
Splunk Employee

Do your extractions first, then for each event (before using stats functions), replace the fields that are null by a text value.

example for the field myfield;


| eval myfield=if(isnull(myfield),"missing",myfield)

yannK
Splunk Employee
Splunk Employee

acid, thanks, I looked for this command for months !!!

0 Karma

acidkewpie
Path Finder

Oh, hang on... Shouldn't this be using "| fillnull value=NONE myfield"? Isn't that going to be much more efficient?

0 Karma

acidkewpie
Path Finder

brilliant, thanks

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...