Refine your search:

This problem generally occurs when you want to create a dashboard that contains a timerange picker and want to populate the dashboard using summary data, and you have summary data available in multiple granularities. For example, you may have 5 minute summaries and daily summaries. So if the user selected a timerange of a month, you'd want to use the daily summaries, but if they selected a timerange of a few hours or a day, you'd want to use the 5minute summaries. There isn't a straightforward way of doing this.

asked 07 Mar '11, 22:32

steveyz's gravatar image

steveyz ♦
1.1k14
accept rate: 55%


One Answer:

The easiest way of doing this involves using addinfo in a subsearch. Basically, subsearches inherit the timerange of the outer search. The addinfo command will create several fields that contain the UTC earliest and latest time bounds of the search. Then you can use the subsearch to expand to different search expressions depending on the range of latest-earliest.

Example:

index=summary [ stats count | addinfo | eval range=info_max_time - info_min_time | eval search=if(range>((86400*7)-3600),"source=daily_summaries","source=5m_summaries") ] | timechart count by host
link

answered 07 Mar '11, 22:41

steveyz's gravatar image

steveyz ♦
1.1k14
accept rate: 55%

Note that stats count in the subsearch just searches to a create a single dummy row so that addinfo can populate it with the info_* fields

(07 Mar '11, 22:49) steveyz ♦
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:

×1,083
×150
×130
×46

Asked: 07 Mar '11, 22:32

Seen: 284 times

Last updated: 07 Mar '11, 22:41

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