Splunk Search

How to categorize time into group?

JimLucas
New Member

Hi Splunkers,

I am looking for a query to categorize timestamp into Morning, Afternoon, Night. I'm using this to know how many items were seen for each category in a month

0001-0800 = Morning
0801-1600 = Afternoon
1601-0000 = Night

Example output:

Date                      Time     Category
02-May-2023    1043    Afternoon
02-May-2023    1932    Night
04-May-2023    0249    Morning
04-May-2023    0717    Morning
14-May-2023    2051    Night
20-May-2023    0534    Morning

Thank you very much

Labels (4)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| bin _time span=8h aligntime=@d
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Data Management Digest – September 2026

    Welcome to the September 2026 edition of Data Management Digest! September brought a fresh wave of ...

Federated Search for CloudWatch Unified Data Store Is Generally Available

As organizations modernize their cloud environments, AWS workloads generate more security, operational, and ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...