Splunk Search

Can you help me use the tstats command with a fillnull?

chris94089
Path Finder

Greetings,

So, I want to use the tstats command. It's super fast and efficient. But not if it's going to remove important results. Any record that happens to have just one null value at search time just gets eliminated from the count. That's important data to know.

With classic search I would do this:

index=* mysearch=*
| fillnull value="null" field1 field2 (etc...)
| stats count by field1 field2 (etc...)

with this, I see my events, and if one shows up as "null" in a couple fields, well, I know it was empty!

Can this be accomplished with the tstats command? Thank you so much.

Sincerely,
A want-to-be tstats advocate

kamlesh_vaghela
SplunkTrust
SplunkTrust

@chris94089

Can you please try this?

|tstats count values(field1) as field1 values(field2) as field2 where index=YOUR_INDEX by _time | fillnull field1 field2 value="NULL" | stats sum(count) as count by  field1 field2

My Sample Search:

|tstats count values(component) as component where index=_internal by _time index | fillnull component value="NULL" | stats sum(count) as count by  component

Thanks

0 Karma

harsmarvania57
Ultra Champion

Hi @kamlesh_vaghela,

It looks like only those fields we can use with tstats which is extracted at time of indexing, as I am running walklex on _internal index bucket and I can see component field in tsidx file so we can use that in tstats but not other fields like bytes from _internal index with above query (If we use datamodel then we can definitely use that 🙂 but without datamodel I think tstats limits with only fields which are extracted at index time)

0 Karma
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 ...