Splunk Search

Using stats with a by on 2 fields works, but how can I do this with timechart?

HattrickNZ
Motivator

Using stats with a by on 2 fields works:

...| stats max(kpi1) as "kpi1" max(kpi2) as "kpi2" by field1 field2

but can I do the same using timechart? (so far I don't think I can)

...| timechart max(kpi1) as "kpi1" max(kpi2) as "kpi2" by field1 field2

A work around I have is to use strcat which would be something like:

...| strcat field1 "-" field2  field1_2 | timechart max(kpi1) as "kpi1" max(kpi2) as "kpi2" by field1_2

Just wondering what other people do?

0 Karma

emiller42
Motivator

You can't visualize this directly, but I use the following when I want time series data on multiple dimensions:

...| bucket _time | stats count by _time field_1 field_2

HattrickNZ
Motivator

tks, as you say not great for visualisation but looks good it the stats tab.
How do I control the _time granularity using this way?

0 Karma

emiller42
Motivator

You can optionally add a span= to bucket just like timechart.

... | bucket _time span=1d | ...
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...