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
Revered Legend

Try this

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

View solution in original post

somesoni2
Revered Legend

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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...