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!

Splunk Platform | Upgrading your Splunk Deployment to Python 3.9

Splunk initially announced the removal of Python 2 during the release of Splunk Enterprise 8.0.0, aiming to ...

From Product Design to User Insights: Boosting App Developer Identity on Splunkbase

co-authored by Yiyun Zhu & Dan Hosaka Engaging with the Community at .conf24 At .conf24, we revitalized the ...

Detect and Resolve Issues in a Kubernetes Environment

We’ve gone through common problems one can encounter in a Kubernetes environment, their impacts, and the ...