Splunk Search

Chart or timechart by multiple values

sherpedz
Loves-to-Learn Lots

I have a chart that I can split by myDate or env, but I cannot get it to split by both myDate and env for example I need to see how many urgency events have taken place on a given myDate by each of the env (environments).

I have used multiple versions of splitting the code and just cannot get this right - any help will be great, this is related to Splunk ES.

`notable`
| eval env=coalesce(src_bunit, dvc_bunit, dest_bunit)
| eval env=upper(env)
| fillnull value="Unknown" env
| search NOT `suppression` AND env=*
| eval myDate=strftime(_time, "%Y-%m-%d")
| chart count by env urgency
| table myDate env critical high medium low informational
| fillnull critical high medium low informational
| rename env AS Environment, critical AS Critical, high AS High, medium AS Medium, low AS Low, informational AS Informational
| addtotals col=true labelfield=Environment label="Total(s)" row=true

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

chart loses myDate. Try using stats and then create a field with the name for the series and use that for the xyseries. Something like this:

`notable`
| eval env=coalesce(src_bunit, dvc_bunit, dest_bunit)
| eval env=if(like(env,"%tgw%") OR like(env,"%TGW%"),"DCT",env)
| eval env=upper(env)
| fillnull value="Unknown" env
| search NOT `suppression` AND env=*
| eval myDate=strftime(_time, "%Y-%m-%d")
| stats count by myDate env urgency
| eval envurgency=env.":".urgency
| xyseries myDate envurgency count

 

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

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