Splunk Search

How to show custom message

splunking1t
New Member

Below is the source of my code. I want to display "A Custom Message" instead of "No results found" I tried many ways but still it shows me No results found. How can i do that and when I've results i want to see the bar chart with tableName which somehow is not showing now. My Splunk Version is 7.0.1
My Query: index=index sourcetype="sourcetype" TableName=* ErrorTotal>0
| chart sum(Errors) as "Error Row",sum(When) as "Conditional Rows",sum(NULL) as "NULL" by TableName

TestDashboard index=index sourcetype="sourcetype" TableName=* ErrorTotal>0 | chart sum(Errors) as "Error Row",sum(When) as "Conditional Rows",sum(NULL) as "NULL" by TableName -24h@h now 1 ellipsisNone 0 visible visible visible none linear none linear none 0 inherit bar 50 10 area gaps none 0.01 default minimal none 0 0 ellipsisMiddle standard right 2 0 1 medium

Tags (1)
0 Karma

somesoni2
Revered Legend

Give this a try

index=index sourcetype="sourcetype" TableName=* ErrorTotal>0
| chart sum(Errors) as "Error Row",sum(When) as "Conditional Rows",sum(NULL) as "NULL" by TableName
| appendpipe [| stats count | where count=0 | eval Message="Your Custom Message Here" | table Message]
0 Karma

splunking1t
New Member

Thanks Somesoni2 for your response. I tried this earlier and it doesn't still shows the custom message.

0 Karma

somesoni2
Revered Legend

There was a missing double quotes which I added now.

I got similar query working for me. See this runanywhere sample search , need access to _internal index in order to run it. Just add some dummy keywords in the base search so that it will not return anything.

index=_internal sourcetype=scheduler  result_count>0| chart sum(result_count) as ResultCount sum(run_time) as "RunTime" by status | appendpipe [| stats count | where count=0 | eval Message="Custom"| table Message]
0 Karma

splunking1t
New Member

Yes, I saw there was a missing quotes and added that. I tried the sample query as well but still I see my chart with lines when there're no results instead of custom message.

0 Karma

somesoni2
Revered Legend

So you do see a table with custom message in Statistics tab? What should your bar chart show when there are no results.?

0 Karma

splunking1t
New Member

Yes, I see the custom message in statistics tab. It still shows me empty bar chart.
If in case there're no result Instead of showing an empty bar chart I wanted to show a custom message eg. "No errors Found".

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...