Splunk Search

Grouping and counting by field

mjmcloughlin
Engager

Hey, I'm looking for a little advice.

I'm trying to produce a report showing how many events of a particular type (where the type is defined by a field) have happened grouped by a given time span... say 10 minutes.

So ideally it would look something like this

Time                |  HHProjection | Importer |
------------------------------------------------
2014-07-30T14:04:00 |           200 |      230 |

The closest I've got is something along these lines

* | where Stage = "HHProjection" or Stage="Importer" | eval formattedTime = strftime(_time, "%FT%H:%M:00") | stats count by Stage, formattedTime

But as you can tell this produces a line per Stage rather than a column per Stage.

As a complete beginner how would I go about writing this query?

Thanks in advance

Tags (1)
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try this

Stage="HHProjection" or Stage="Importer" | timechart span=10m count by Stage

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Try this

Stage="HHProjection" or Stage="Importer" | timechart span=10m count by Stage

mjmcloughlin
Engager

perfect, thanks!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...