Splunk Search

Hiding null value results

Bo3432
Explorer

Hello,

I am trying to find a command that will allow me to create a table and only display values. when using the user agent field in my table, there are some values that are null. I only want values to display. 

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Yes, it can be used with a table and all other visualizations.

When you say "it is giving no results" does that mean the where command is not filtering as expected or you are getting nothing at all from the query?  If the former, then it's possible the userAgent field is all spaces so the filter should be modified to handle that.  For the latter, try renaming the fields to eliminate dots.

index=azure sourcetype="azure:monitor:aad" action=*
| rename properties.* as *
| where isnotnull(userAgent) AND userAgent!=""
|table _time user deviceDetail.displayName userAgent action
|sort -_time

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Use the where command to filter out results with empty fields.

| where isnotnull(user_agent) AND user_agent!=""
---
If this reply helps you, Karma would be appreciated.
0 Karma

Bo3432
Explorer

Can this be used with a table?  This is my command but it is giving no results. 

index=azure sourcetype="azure:monitor:aad" action=*
| where isnotnull(properties.userAgent) AND properties.userAgent!=""
|table _time user properties.deviceDetail.displayName properties.userAgent action
|sort -_time

0 Karma

bowesmana
SplunkTrust
SplunkTrust

@Bo3432 The where clause takes an eval statement and in eval statements you need to wrap 'odd' field names with single quotes. In your case properties.userAgent contains a full-stop, so you need to use

| where isnotnull('properties.userAgent') AND 'properties.userAgent'!=""

richgalloway
SplunkTrust
SplunkTrust

Yes, it can be used with a table and all other visualizations.

When you say "it is giving no results" does that mean the where command is not filtering as expected or you are getting nothing at all from the query?  If the former, then it's possible the userAgent field is all spaces so the filter should be modified to handle that.  For the latter, try renaming the fields to eliminate dots.

index=azure sourcetype="azure:monitor:aad" action=*
| rename properties.* as *
| where isnotnull(userAgent) AND userAgent!=""
|table _time user deviceDetail.displayName userAgent action
|sort -_time

 

---
If this reply helps you, Karma would be appreciated.

Bo3432
Explorer

That did it. Much appreciated. 

Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...