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!

Splunk App Dev Quarterly Roundup: AI, Agents, and Innovation!

Another quarter, another wave of innovation. From complex integrations to pushing the limits ...

Federated Search for Dynamic Data Self Storage Is Now Generally Available on Splunk ...

 Splunk is excited to announce the General Availability of Federated Search for Dynamic Data Self Storage ...

Index This | What has many keys but can’t unlock a door?

July 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...