Splunk Search

Merge two line charts

super_virus
New Member

Hi ,

Very new to splunk.
I need to search a index with two strings example:

"ABC1"
"XVZ2"

And create a line graphs of the count of time we found those two strings. I have two searches that do this for each string and create separate graphs .

Graph 1 : index=index_name host="host1" OR "host2" "ABC1" | timechart count(_raw) as error span=1h
GRAPH 2 : index=index_name host="host1" OR "host2" "XVZ2"| timechart count(_raw) as warning span=1h

How can i merge these graphs? I need to have one chart with two lines (one for error and other for warning ) representing the above searches . Please help.

0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try like this

index=index_name (host="host1" OR "host2") "ABC1" OR "XVZ2"
| eval error=if(searchmatch("ABC1"),1,0)
| eval warning=if(searchmatch( "XVZ2"),1,0)
| timechart span=1h sum(error) as error sum(warning) as warning

View solution in original post

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try like this

index=index_name (host="host1" OR "host2") "ABC1" OR "XVZ2"
| eval error=if(searchmatch("ABC1"),1,0)
| eval warning=if(searchmatch( "XVZ2"),1,0)
| timechart span=1h sum(error) as error sum(warning) as warning
0 Karma

super_virus
New Member

Thanks ! This works!

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...