Splunk Search

How to display two lines in a linechart based on one value?

Bleepie
Communicator

Dear Splunk Community,

Every 5 minutes the following event is generated :

2022-01-05 21:20:33 : Running

OR

2022-01-05 20:19:33 : Failed

I would like to display a timeline with two (2) lines showing when the system is running and when it fails. I have come so far:

 

running OR failed
| eval status = if(like(_raw, "%Running%"), "Running", "Not running")
| table status

 

 

I am in need of some guidance in this matter. How do I change the above search so that I have a line chart visualization with the two lines in it?

Thanks in advance.

 

 

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
running OR failed
| eval running= if(like(_raw, "%Running%"), 1, 0)
| eval notrunning= if(like(_raw, "%Running%"), 0, 1)
| table _time running notrunning

View solution in original post

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Are you thinking of timechart?

running OR failed
| rex "\s+:\s+(?<status>\w+)"
| timechart span=5m count by status

(rex is more standard way of extracting info with the type of  data you illustrated.)

0 Karma

Bleepie
Communicator

Thanks for your reply. I have however accepted the other answer as it gives me a visually more appealing result.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
running OR failed
| eval running= if(like(_raw, "%Running%"), 1, 0)
| eval notrunning= if(like(_raw, "%Running%"), 0, 1)
| table _time running notrunning
0 Karma
Get Updates on the Splunk Community!

Announcing the Expansion of the Splunk Academic Alliance Program

The Splunk Community is more than just an online forum — it’s a network of passionate users, administrators, ...

Learn Splunk Insider Insights, Do More With Gen AI, & Find 20+ New Use Cases You Can ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Buttercup Games: Further Dashboarding Techniques (Part 7)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...