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!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...