<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: charting state as sequence of values in time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/charting-state-as-sequence-of-values-in-time/m-p/148912#M41624</link>
    <description>&lt;P&gt;It is always nice to see an excerpt of the log, but I will hazard a guess&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| eval status=if(match(_raw,"UNPLUGGED"),0,1)
| timechart span=10s avg(status)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You will not be able to show a very large timespan in a single chart, but this should work. It would be nicer if you had a field that contained the status, but that isn't necessary.&lt;/P&gt;

&lt;P&gt;UPDATE: sorry, that was a dumb mistake on my part. I have updated the proposed solution to use &lt;CODE&gt;avg(status)&lt;/CODE&gt; instead of just &lt;CODE&gt;status&lt;/CODE&gt;. You could actually use almost any of the functions: first, last, avg - since there should only be one event in any 10 second period. But don't be surprised if you see two events (or zero events) in a time period; things are rarely perfect all the time...&lt;/P&gt;</description>
    <pubDate>Wed, 10 Dec 2014 22:46:02 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2014-12-10T22:46:02Z</dc:date>
    <item>
      <title>charting state as sequence of values in time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/charting-state-as-sequence-of-values-in-time/m-p/148911#M41623</link>
      <description>&lt;P&gt;I have a log that contains a polling state of a device, PLUGGED/UNPLUGGED, logged every 10 s.&lt;BR /&gt;
I want to chart a timeline in which each state is a point and y values are: PLUGGED=1,UNPLUGGED=0 so I can view the state of the device over the timespan.&lt;BR /&gt;
How I get this?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2014 22:23:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/charting-state-as-sequence-of-values-in-time/m-p/148911#M41623</guid>
      <dc:creator>idsiano</dc:creator>
      <dc:date>2014-12-10T22:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: charting state as sequence of values in time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/charting-state-as-sequence-of-values-in-time/m-p/148912#M41624</link>
      <description>&lt;P&gt;It is always nice to see an excerpt of the log, but I will hazard a guess&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| eval status=if(match(_raw,"UNPLUGGED"),0,1)
| timechart span=10s avg(status)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You will not be able to show a very large timespan in a single chart, but this should work. It would be nicer if you had a field that contained the status, but that isn't necessary.&lt;/P&gt;

&lt;P&gt;UPDATE: sorry, that was a dumb mistake on my part. I have updated the proposed solution to use &lt;CODE&gt;avg(status)&lt;/CODE&gt; instead of just &lt;CODE&gt;status&lt;/CODE&gt;. You could actually use almost any of the functions: first, last, avg - since there should only be one event in any 10 second period. But don't be surprised if you see two events (or zero events) in a time period; things are rarely perfect all the time...&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2014 22:46:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/charting-state-as-sequence-of-values-in-time/m-p/148912#M41624</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-12-10T22:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: charting state as sequence of values in time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/charting-state-as-sequence-of-values-in-time/m-p/148913#M41625</link>
      <description>&lt;P&gt;I got the results with this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = hcd2 source="/algorithm/logs/debug.log" Plug_state 
| eval status=if(match(Plug_state,"EV_UNPLUGGED"),0,1) 
| timechart span=5s avg(status)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that timechart need an aggregation function, the only one that returns values similar to the discrete 0 and 1 is avg.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2014 07:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/charting-state-as-sequence-of-values-in-time/m-p/148913#M41625</guid>
      <dc:creator>idsiano</dc:creator>
      <dc:date>2014-12-11T07:55:25Z</dc:date>
    </item>
  </channel>
</rss>

