Splunk Search

Chart

mvasquez21
Path Finder

My boss has asked me to create a chart that shows the number of fired alerts (y-axis) by day of the month (x-axis). I suggested we do this as a stacked chart with each alert represented by a different color. I know the alert variable is "ss_name" and i found this expression to create the "date":

convert timeformat="%m-%d" ctime(_time) AS date

I just cant get the correct syntax to get all 3 elements in to the chart. So far i have this:

index=_audit action="alert_fired" | convert timeformat="%m-%d" ctime(_time) AS date | timechart date by ss_name

 

Thanks!

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try adding

| xyseries date, ss_name, count

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

How about something like

index=_audit action="alert_fired" | convert timeformat="%m-%d" ctime(_time) AS date | stats count by ss_name, date

Then use a stacked bar chart in your dashboard panel 

0 Karma

mvasquez21
Path Finder

i had tried that one already but it puts count and date as the only x-axis items instead of the ss_name (alerts)

Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try adding

| xyseries date, ss_name, count

mvasquez21
Path Finder

mvasquez21_0-1598626596705.png

 

0 Karma

mvasquez21
Path Finder

perfect! thanks!

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @mvasquez21,

why do you want to complicate the search?

timechart is sufficient for your need:

 

index=_audit action="alert_fired" earliest=-30d@d latest=@d
| timechart span=1d count

 

if you want to know how many alerts you fired for each kind of alert, you could run something like this:

 

index=_audit action="alert_fired" earliest=-30d@d latest=@d
| timechart span=1d count BY ss_name

 

but it depends on the number of different alerts: if they are too many your chart isn't readable.

 

The problem is that you want to run a search on a long time (one month) and, if you have many events, this is a very slow search.

So you could schedule this  search as a report by night and display it very quickly or schedule a search saving results in a summary index and running the search on the summary index.

Ciao.

Giuseppe

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!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...