Refine your search:

I am trying to create a table or timechart that tracks averages for an event from the 3rd Tuesday of every month to the 3rd Monday in the following month (on a reoccurring basis). For example I want the output to look like:

Time Range Average 1/17/12-2/20/12 14.8 2/21/12-3/19/12 15.3

Can someone please help me figure out how to write this query? Thank you for all of your help.

asked 15 Mar '12, 09:13

grhick's gravatar image

grhick
11
accept rate: 0%

edited 15 Mar '12, 09:24


One Answer:

Try this

yoursearchhere |
eval earliest=relative_time(now(),"-2mon@mon") |
eval earliest=relative_time(earliest,"+21d") |
eval earliest=relative_time(earliest, "@w2") |
eval latest = relative_time(earliest,"+28d") |
where _time >= earliest AND _time <= latest |
timechart avg(yourfield)

Good luck! BTW, you realize that if you run this each month, some days will get skipped. Also, you might want to change the second line from "-2mon@min" to "-1mon@mon", depending on when you run the search each month.

link

answered 18 Mar '12, 01:32

lguinn's gravatar image

lguinn ♦
10.9k5723
accept rate: 28%

Thank you very much for the response. I will try this and let you know how it worked.

(21 Mar '12, 13:07) grhick
Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×285

Asked: 15 Mar '12, 09:13

Seen: 445 times

Last updated: 21 Mar '12, 13:07

Copyright © 2005-2012 Splunk Inc. All rights reserved.