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
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...