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 Cloud Application Management in Terraform

Now On-Demand   We’re diving into how you can bring Infrastructure as Code (IaC) principles to your Splunk ...

What's New in Splunk Enterprise Security (ES) 8.6

Purpose-Built AI Agents for the Agentic SOC  Splunk Enterprise Security 8.6 expands AI in Security with ...

From Raw Data to Executive-Ready Stories, Faster

Build Data Stories for Every Audience  A dashboard is rarely just a dashboard. It might be the view an ...