Splunk Search

last 30 days daily count based on filed

dhavamanis
Builder

We have a field with timestamp data like "2013-04-30 19:34:23" as Last_Log_In, how do we find last 30 days daily Last_Log_In count.

0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Something like this?

sourcetype=csv | epoch = strftime(Last_Log_In, "%Y-%m-%d %H:%M:%S")
| bin span=1d epoch | where relative_time(now(), "-30d@d") <= epoch
| stats count as Log_In_Counts by epoch | fieldformat epoch = strftime(epoch, "%F")

Row 1 grabs your data and converts your string to an epoch date, row 2 groups that date by day and filters for last 30 days, row 3 runs your counting report and formats the epoch as a user-readable date.

View solution in original post

Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...