Refine your search:

Hi how should I modify my search to make it work?

host="javaserver1" source="/var/log/javastuff.log" earliest=-1d@d latest=-0d@d Sending failed | multikv | eval ReportKey="yesterday" | append [search host="javaserver1" source="/var/log/javastuff.log" earliest=-0d@d latest=now Sending failed | multikv | eval ReportKey="today"] |timechart span="1h" count by ReportKey

While today's results are displayed, yesterday's results are zero for every hour, then when yesterday's results begin displaying other values than zero, today's results are displayed all as zeroes.

Any solution to this?

Thank you

asked 15 Mar '12, 03:31

dackamen's gravatar image

dackamen
311
accept rate: 0%

edited 15 Mar '12, 03:52

lguinn's gravatar image

lguinn ♦
11.5k5824


2 Answers:

The append command adds today's results as separate events following yesterday's. Then timechart sums the events based on _time, so the two series will not overlap. Try this instead

host="javaserver1" source="/var/log/javastuff.log" earliest=-1d@d latest=now Sending failed |
multikv | 
eval hour = strftime(_time,"%H") |
eval reportKey = if(_time<relative_time(now(), "-0d@d"),"yesterday","today") |
chart count over hour by reportKey
link

answered 15 Mar '12, 03:52

lguinn's gravatar image

lguinn ♦
11.5k5824
accept rate: 28%

edited 22 Jun '12, 15:21

Another alternative:

host="javaserver1" source="/var/log/javastuff.log" earliest=-1d@d latest=-0d@d Sending failed | multikv | eval ReportKey="yesterday" | 
eval _time=relative_time(_time,"+1d") |
append [search host="javaserver1" source="/var/log/javastuff.log" earliest=-0d@d latest=now Sending failed | multikv | eval ReportKey="today"] |
timechart span="1h" count by ReportKey

Notice that this is the same as your original search BUT I added one day to the timestamp. This forces the data from yesterday to plot over the same time period as the data from today.

The other solution should be faster in most cases, but this will be more flexible when you really want to use a timechart.

link

answered 08 May '12, 13:42

lguinn's gravatar image

lguinn ♦
11.5k5824
accept rate: 28%

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:

×26
×1
×1

Asked: 15 Mar '12, 03:31

Seen: 911 times

Last updated: 22 Jun '12, 15:21

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