Splunk Search

How to search a Line Graph to show monthly trends

Yy4pb
Explorer

Hi,

I am new to Splunk and struggling to create Line Graphs. I have a query which display a count for the month:

 

 

 

index="app" earliest=1640995200 latest=1643673600 | stats count AS January | appendcols [search index="app" earliest=1643673600 latest=1646092800 | stats count AS February]

 

 

 

This is correctly presenting the information as I would expect it:

Yy4pb_0-1644922707411.png

I am almost certain my search is not correct, as when I attempt to plot this on a Line Graph the axis are not correct. I would like the Total number on the Y axis, and the months along the X axis. 

Would appreciate any guidance. Thank you! 

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @Yy4pb,

did you tried something like this:

index="app" earliest=1640995200 latest=1646092800 
| eval date_mon=strftime(_time,"%B")
| stats count BY date_mon

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @Yy4pb,

did you tried something like this:

index="app" earliest=1640995200 latest=1646092800 
| eval date_mon=strftime(_time,"%B")
| stats count BY date_mon

Ciao.

Giuseppe

Yy4pb
Explorer

That looks good and works, but how would I compare results with the previous month on the linegraph as well? Thanks

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Yy4pb,

instead dedining earliest and latest, you could define time borders using the Time Picker, then the eval command will define the month to use in the line graph.

If you want a delta from the values of each month, you could use the command "delta":

index="app" earliest=1640995200 latest=1646092800 
| eval date_mon=strftime(_time,"%B")
| stats count BY date_mon
| delta count

Ciao.

Giuseppe

 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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