Splunk Search

How to get the count (Exceptions) for last 5 days in a single table?

Madhan45
Path Finder

This is my expected result:

Exceptions  Day1  Day2  Day3  Day4  Day5
Abc          5     4     3     1     0
Start        3     4     4     5     6       
xyz          3     2     5     0     0
Tags (3)
0 Karma
1 Solution

renjith_nair
Legend

Try this

your search |chart count over Exceptions by <day field>

or if you don't have a day field

        your search |chart span=1d count over Exceptions by _time
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

Try this

your search |chart count over Exceptions by <day field>

or if you don't have a day field

        your search |chart span=1d count over Exceptions by _time
---
What goes around comes around. If it helps, hit it with Karma 🙂

Madhan45
Path Finder

It shows results only for first exception.!!

0 Karma

renjith_nair
Legend

Do you have other Exceptions in the events? Just try this to see how it works

    index=* earliest=-7d|chart count over sourcetype by _time span=1d
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

Madhan45
Path Finder

great working fine. But now the problem is dates are in epoch format. How to convert that in to normal format?

0 Karma

Madhan45
Path Finder

Found Now it is working fine.
index=_internal sourcetype=* earliest=-7d | eval time=strftime(_time,"%m/%d/%y") |chart count over sourcetype by time span=1d

0 Karma

Madhan45
Path Finder

Thank you renjith

0 Karma

renjith_nair
Legend

You are welcome, Please mark as answer so that the thread will be closed

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

renjith_nair
Legend

Just convert time before chart ie

     index=* earliest=-7d|eval _time=strftime(_time,"%d-%m-%Y")|chart count over sourcetype by _time span=1d

You can use other variables instead of _time as well.

If you got the answer, just mark as answer so that the thread will be closed

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...