<?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: Timechart question:- combining two values for plotting timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464484#M130894</link>
    <description>&lt;P&gt;Hi cbhattad,&lt;BR /&gt;
why you need the lookup values?, you could calculate totals in the same search.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2019 07:25:44 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2019-10-23T07:25:44Z</dc:date>
    <item>
      <title>Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464479#M130889</link>
      <description>&lt;P&gt;My query is something like below&lt;/P&gt;

&lt;P&gt;index = "A" | table x | stats dc(x) as total  | appendcols [search index = "B" earliest="d" latest="@now" | table y | stats dc (y) as active ] | eval ratio = active/total&lt;/P&gt;

&lt;P&gt;index "B" consists of real time events and we get distinct user counts in variable "active".&lt;BR /&gt;
index "A" consists of total user count&lt;/P&gt;

&lt;P&gt;I want to plot ratio over a period of time (span = 1h)&lt;/P&gt;

&lt;P&gt;Tried few queries but couldn't get to the result&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 11:38:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464479#M130889</guid>
      <dc:creator>cbhattad</dc:creator>
      <dc:date>2019-10-22T11:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464480#M130890</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
did you already tried something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index = "A") OR (index = "B" earliest="d" latest="@now")
| timechart dc(x) as total dc(y) as active  
| eval ratio = active/total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 11:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464480#M130890</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-22T11:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464481#M130891</link>
      <description>&lt;P&gt;Actually one of them is inputlookup and other is an index.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 06:35:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464481#M130891</guid>
      <dc:creator>cbhattad</dc:creator>
      <dc:date>2019-10-23T06:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464482#M130892</link>
      <description>&lt;P&gt;Hi cbhattad,&lt;BR /&gt;
theoretically it's the same thing, put the index in the main search and then add the lookup&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = "B" earliest="d" latest="@now"
| append [ | inputlookup your_lookup.csv | fields y _time ]
| timechart dc(x) as total dc(y) as active  
| eval ratio = active/total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But you can use timechart only if you have _time field also in lookup.&lt;/P&gt;

&lt;P&gt;Could you share more information about your use case?&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 07:01:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464482#M130892</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-23T07:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464483#M130893</link>
      <description>&lt;P&gt;Oh, now I get it.&lt;BR /&gt;
inputlookup just stores the total count and does not have a time column.&lt;BR /&gt;
It's like a static value.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 07:22:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464483#M130893</guid>
      <dc:creator>cbhattad</dc:creator>
      <dc:date>2019-10-23T07:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464484#M130894</link>
      <description>&lt;P&gt;Hi cbhattad,&lt;BR /&gt;
why you need the lookup values?, you could calculate totals in the same search.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 07:25:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464484#M130894</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-23T07:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464485#M130895</link>
      <description>&lt;P&gt;Hi @gcusello &lt;BR /&gt;
The other index only stores the realtime activity, not the totals.&lt;BR /&gt;
The lookup is updated by a different process which maintains the totals in lookup.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 07:30:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464485#M130895</guid>
      <dc:creator>cbhattad</dc:creator>
      <dc:date>2019-10-23T07:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464486#M130896</link>
      <description>&lt;P&gt;Hi cbhattad,&lt;BR /&gt;
try to use appendpipe command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = "B" earliest="d" latest="@now"
| timechart dc(y) as active  
| appendpipe [ | inputlookup your_lookup | fields total]
| stats values(active) As active values(total) AS total BY _time
| eval ratio = active/total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 07:43:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464486#M130896</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-23T07:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464487#M130897</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index = "A" | timechart dc(user_id) as active  | appendpipe [ | inputlookup users.csv | fields user_id | stats dc(user_id) as total ] | stats values(active) As active values(total) AS total BY _time | eval ratio = active/total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Tried the above, in this "total" column is always empty&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 07:57:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464487#M130897</guid>
      <dc:creator>cbhattad</dc:creator>
      <dc:date>2019-10-23T07:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464488#M130898</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults count=2
| streamstats count
| eval _time=round(_time / 60 ) * 60
| eval _time=if(count==2,relative_time(_time,"-24h"),_time)
| makecontinuous _time span=1m
| eval user_id = random() % 100 + 1
| timechart span=1h dc(user_id) as active
| eval total = [| makeresults count=100
| eval user_id = random() % 100 + 1
| stats dc(user_id) as total
| return $total]
| stats values(active) As active values(total) AS total BY _time 
| eval ratio = round(active/total,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi,All&lt;BR /&gt;
This is sample query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = "A" 
| timechart dc(user_id) as active
| eval total =  [ | inputlookup users.csv 
| fields user_id 
| stats dc(user_id) as total 
| return $total] 
| eval ratio = active/total
| fields _time active total ratio
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How about this?&lt;BR /&gt;
@gcusello ,  I'm sorry to break into a conversation.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 10:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464488#M130898</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-10-23T10:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464489#M130899</link>
      <description>&lt;P&gt;No problem!&lt;BR /&gt;
Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 10:13:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464489#M130899</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-23T10:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464490#M130900</link>
      <description>&lt;P&gt;Thank you so much @to4kawa&lt;BR /&gt;
you saved my day&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 10:44:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464490#M130900</guid>
      <dc:creator>cbhattad</dc:creator>
      <dc:date>2019-10-23T10:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464491#M130901</link>
      <description>&lt;P&gt;your welcome, Happy Splunking.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 11:02:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464491#M130901</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-10-23T11:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464492#M130902</link>
      <description>&lt;P&gt;One more thing,  as shown in the image, for 2:00 am it shows 0.79, actually, the value should be it should be for 3:00 am. Somehow, splunk searches in reverse way and scans for events in from 3:00 am to 2:00 am and then assigns the value for 2:00 am as in the below image.&lt;BR /&gt;
I want it in other way round. the value should be shown at 3:00 am&lt;/P&gt;

&lt;P&gt;Any idea how can we do it?&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://i.ibb.co/3FyJTH2/Screen-Shot-2019-10-23-at-4-50-52-PM.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:57:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464492#M130902</guid>
      <dc:creator>cbhattad</dc:creator>
      <dc:date>2019-10-23T12:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart question:- combining two values for plotting timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464493#M130903</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;_time   active  total   ratio
2019-10-22 23:00    20  69  0.29
2019-10-23 00:00    45  69  0.65
2019-10-23 01:00    45  69  0.65
2019-10-23 02:00    43  69  0.62
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If time and numerical values ​​are described in statistical information in this way, they will not deviate.&lt;/P&gt;

&lt;P&gt;Please check the statistics.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 14:45:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-question-combining-two-values-for-plotting-timechart/m-p/464493#M130903</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-10-23T14:45:11Z</dc:date>
    </item>
  </channel>
</rss>

