Splunk Search

Fillnull on an eval field post stats

ebs
Communicator

Hi,

I want to do a fillnull on an eval created field post stats but it never works quite right with either creating the null field in the eval field or just not working at all. What I want is when it performs a stats on all the eval fields, if there are no results in one to just return a 0.

Here is the base search:

| datamodel Test summariesonly=true search
| search "TEST.date"=2021-05-18| rename "TEST.date" as date
| rename "TEST.uri_path" as uri_path
| eval category=case(like(uri_path, "/url1"), "highPriority", uri_path="/url2", "unattended",
uri_path="/url3", "lowPriority", uri_path="/url4", "largePayload")
| rename "TEST.response_time" as response_time
| stats avg(response_time) by category
| rename avg(response_time) as averageResponse
| eval averageResponse=round(averageResponse,3)
| transpose 0 header_field=category

If for example there were no url3 i.e. unattended, I would want a 0 under the unattended column

Results if I put fillnull before stats avg():

Labels (5)
0 Karma
1 Solution

ebs
Communicator

Worked it out, after transpose add these lines:

| fillnull value=0 highPriority, lowPriority, largePayload, unattended
| fields highPriority, lowPriority, largePayload, unattended, date

View solution in original post

0 Karma

ebs
Communicator

Worked it out, after transpose add these lines:

| fillnull value=0 highPriority, lowPriority, largePayload, unattended
| fields highPriority, lowPriority, largePayload, unattended, date

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...