Splunk Search

How to make a timechart by shift?

topperud
Engager

Hi all, 

I am trying to create a timechart that divides the data by 12 hour shifts. I have
| timechart span = 12h (followed by all the data)

How do I make each span start at 0600 and 1800? 

Thanks!

Labels (2)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Align your time period to 6pm for example

earliest=-7d@d-6h

Rather than using timechart, you could split it up into the different steps.

| bin span=12h _time
| stats your metrics by your groups and _time
| xyseries _time group metric

However, this will align to midnight and noon, so make adjustments before and after

| eval _time=relative_time(_time,"-6h")
| bin span=12h _time
| stats your metrics by your groups and _time
| eval _time=relative_time(_time,"+6h")
| xyseries _time group metric

 

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Align your time period to 6pm for example

earliest=-7d@d-6h

Rather than using timechart, you could split it up into the different steps.

| bin span=12h _time
| stats your metrics by your groups and _time
| xyseries _time group metric

However, this will align to midnight and noon, so make adjustments before and after

| eval _time=relative_time(_time,"-6h")
| bin span=12h _time
| stats your metrics by your groups and _time
| eval _time=relative_time(_time,"+6h")
| xyseries _time group metric

 

0 Karma

topperud
Engager

That worked wonderfully, thank you. One thing though, for some reason the +-6 adjusted mine to 10am and pm. No worries though, I just made it +-2 and it worked. Probably has to do with time zone. Thanks again

0 Karma
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...