<?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: How to use Timechart count by a subsearch field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208154#M60687</link>
    <description>&lt;P&gt;Sorry i don't understand Your search:&lt;BR /&gt;
in the first append: you missed another append or you repeat two times "index=index_cbo_pt"? if the second choice you could write your search in a different way.&lt;/P&gt;

&lt;P&gt;Every way, if you didn't miss anything in the search, start debugging dividing the two searches and executing timechart command on each one:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;index=index_cbo "Scope State: 65280" | eval CNPJPDV= CNPJ."-".PDV | timechart span=5m count by PaymentChannelName&lt;/LI&gt;
&lt;LI&gt;index=index_cbo_pt | eval CNPJPDV=CNPJ."-".PDV_PT| search index=index_cbo_pt [search index=index_cbo "Scope State: 65280"    | eval CNPJPDV= CNPJ."-".PDV  | table CNPJPDV | table CNPJPDV PaymentChannelName]| timechart span=5m count by PaymentChannelName&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;In this way you can find if each search has events and all the required fields (CNPJPDV, PaymentChannelName), maybe  there is a problem.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 11:05:41 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-09-29T11:05:41Z</dc:date>
    <item>
      <title>How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208151#M60684</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to use "timechart count by" a field from a subsearch. Bellow, my query that is not working. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index_cbo "Scope State: 65280" | eval CNPJPDV= CNPJ."-".PDV | append [search index=index_cbo_pt | eval CNPJPDV= CNPJ."-".PDV_PT| search index=index_cbo_pt [search index=index_cbo "Scope State: 65280" | eval CNPJPDV= CNPJ."-".PDV  | table CNPJPDV] | table CNPJPDV PaymentChannelName]| timechart span=5m count by PaymentChannelName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It's resulting in a timechart will NULL column.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;P&gt;Cheers, &lt;/P&gt;

&lt;P&gt;rs&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2016 11:29:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208151#M60684</guid>
      <dc:creator>rafasalo</dc:creator>
      <dc:date>2016-09-24T11:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208152#M60685</link>
      <description>&lt;P&gt;Are you getting any valid results? If you are, add &lt;CODE&gt;usenull=f&lt;/CODE&gt; to your timechart.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2016 12:47:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208152#M60685</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-24T12:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208153#M60686</link>
      <description>&lt;P&gt;I do get this:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://lh4.googleusercontent.com/15J_yu9Pqzm13Uc1YlW_ks6B2JuGWR5kqusZz2L98HaeuBLfUgqOJuaVUC3U0jZ7Za8Ypcy5Wy8V1f8=w1362-h670-rw" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;If I use usenull it results on nothng.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2016 13:35:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208153#M60686</guid>
      <dc:creator>rafasalo</dc:creator>
      <dc:date>2016-09-24T13:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208154#M60687</link>
      <description>&lt;P&gt;Sorry i don't understand Your search:&lt;BR /&gt;
in the first append: you missed another append or you repeat two times "index=index_cbo_pt"? if the second choice you could write your search in a different way.&lt;/P&gt;

&lt;P&gt;Every way, if you didn't miss anything in the search, start debugging dividing the two searches and executing timechart command on each one:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;index=index_cbo "Scope State: 65280" | eval CNPJPDV= CNPJ."-".PDV | timechart span=5m count by PaymentChannelName&lt;/LI&gt;
&lt;LI&gt;index=index_cbo_pt | eval CNPJPDV=CNPJ."-".PDV_PT| search index=index_cbo_pt [search index=index_cbo "Scope State: 65280"    | eval CNPJPDV= CNPJ."-".PDV  | table CNPJPDV | table CNPJPDV PaymentChannelName]| timechart span=5m count by PaymentChannelName&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;In this way you can find if each search has events and all the required fields (CNPJPDV, PaymentChannelName), maybe  there is a problem.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:05:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208154#M60687</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T11:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208155#M60688</link>
      <description>&lt;P&gt;Could you explain what the query should do for you? Are you looking to plot timechart of count by PaymentChannelName for events in index=index_cbo_pt where CNPJPDV values matches the one from index_cbo? If yes, then try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index_cbo_pt | eval CNPJPDV= CNPJ."-".PDV_PT| search [search index=index_cbo "Scope State: 65280" | eval CNPJPDV= CNPJ."-".PDV  | stats count by CNPJPDV | table CNPJPDV] |  timechart span=5m count by PaymentChannelName
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:09:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208155#M60688</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T11:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208156#M60689</link>
      <description>&lt;P&gt;Let me explain it.&lt;/P&gt;

&lt;P&gt;I have 2 indexes: &lt;BR /&gt;
a) index_cbo_pt&lt;BR /&gt;
b) index_cbo&lt;/P&gt;

&lt;P&gt;In &lt;STRONG&gt;index_cbo&lt;/STRONG&gt; there are events  with the text "Scope State: 65280". All events with this text has CNPJ and PDV fields, that I concatenate to form CNPJPDV. &lt;/P&gt;

&lt;P&gt;In &lt;STRONG&gt;index_cbo_pt&lt;/STRONG&gt; there are events that indicates in which channel (PaymentChannelName) the CNPJPDV (that I also need to concatenate) are. &lt;/P&gt;

&lt;P&gt;So, I want to see in which channels the events of "Scope State: 65280" are happening. Finally see it along a period of time, this is why I use timechart.&lt;/P&gt;

&lt;P&gt;Please, tell me if I wasn't clear. &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:05:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208156#M60689</guid>
      <dc:creator>rafasalo</dc:creator>
      <dc:date>2020-09-29T11:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208157#M60690</link>
      <description>&lt;P&gt;Let me explain it.&lt;/P&gt;

&lt;P&gt;I have 2 indexes: &lt;BR /&gt;
a) index_cbo_pt&lt;BR /&gt;
b) index_cbo&lt;/P&gt;

&lt;P&gt;In &lt;STRONG&gt;index_cbo&lt;/STRONG&gt; there are events  with the text "Scope State: 65280". All events with this text has CNPJ and PDV fields, that I concatenate to form CNPJPDV. &lt;/P&gt;

&lt;P&gt;In &lt;STRONG&gt;index_cbo_pt&lt;/STRONG&gt; there are events that indicates in which channel (PaymentChannelName) the CNPJPDV (that I also need to concatenate) are. &lt;/P&gt;

&lt;P&gt;So, I want to see in which channels the events of "Scope State: 65280" are happening. Finally see it along a period of time, this is why I use timechart.&lt;/P&gt;

&lt;P&gt;Please, tell me if I wasn't clear. &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:05:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208157#M60690</guid>
      <dc:creator>rafasalo</dc:creator>
      <dc:date>2020-09-29T11:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208158#M60691</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=index_cbo "Scope State: 65280") OR index=index_cbo_pt | eval CNPJPDV= CNPJ."-".PDV_PT | bin span=5m _time | stats values(index) as index count by PaymentChannelName | where mvcount(index)=2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Sep 2016 21:08:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208158#M60691</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-24T21:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208159#M60692</link>
      <description>&lt;P&gt;It doesn't work. I think becase  &lt;CODE&gt;eval CNPJPDV= CNPJ."-".PDV_PT&lt;/CODE&gt; is only possible for &lt;STRONG&gt;index_cbo_pt&lt;/STRONG&gt;. For index_cbo, the eval command is &lt;CODE&gt;eval CNPJPDV= CNPJ."-".PDV&lt;/CODE&gt;. Any ideais?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:05:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208159#M60692</guid>
      <dc:creator>rafasalo</dc:creator>
      <dc:date>2020-09-29T11:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208160#M60693</link>
      <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index_cbo_pt "Scope State: 65280" 
| eval CNPJPDV= CNPJ."-".PDV 
| join CNPJPDV [ search 
     index=index_cbo 
     | eval CNPJPDV= CNPJ."-".PDV 
      ] 
| timechart span=5m count by PaymentChannelName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 05:53:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208160#M60693</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-09-25T05:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208161#M60694</link>
      <description>&lt;P&gt;Giuseppe,&lt;/P&gt;

&lt;P&gt;I've changed a little bit your query (see the new one bellow) and it worked.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index_cbo "Scope State: 65280" 
 | eval CNPJPDV= CNPJ."-".PDV 
 | join CNPJPDV [ search 
      index=index_cbo_pt 
      | eval CNPJPDV= CNPJ."-".PDV_PT 
       ] 
 | timechart span=1h count by PaymentChannelName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Basically what I've changed is that the event "Scope State: 65280" happens in index_cbo.&lt;/P&gt;

&lt;P&gt;The new problem is that by executing this query I don't get all the events. How do I now that? See below the chart of the new query:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://lh3.googleusercontent.com/N-WQJkAVSYiWiyHH1IXXYfV8k-n8mY1OnMKC3cHyGSAvZf29zCqnkVCxFb5vEKdoWbTHP3_NlbH4y_o=w1362-h671-rw" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Now, if I run just part of the new query: &lt;CODE&gt;index=index_cbo_pt "Scope State: 65280"  | timechart span=5m count&lt;/CODE&gt;, I get this:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://lh6.googleusercontent.com/XncYF9QnBIfkMTzNx2aHLh5kkBpJy57BIktmMmFNiUFoQb94jOn55CRUMjWtMY0GCB0Lx7vb64TG4C0=w1362-h671-rw" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;It seems that using JOIN I don't get all the results. Do you have an alternative for the same query using a subsearch or append?&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 10:28:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208161#M60694</guid>
      <dc:creator>rafasalo</dc:creator>
      <dc:date>2016-09-26T10:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Timechart count by a subsearch field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208162#M60695</link>
      <description>&lt;P&gt;Using join you take only events where there is CNPJPDV in both of them.&lt;BR /&gt;
In other words: you use the second search to find the PaymentChannelName field and after you group the results of the first search by PaymentChannelName&lt;/P&gt;

&lt;P&gt;You could also use appendcols instead join, but probably you'll have the same result&lt;BR /&gt;
 &lt;EM&gt;index=index_cbo "Scope State: 65280" &lt;BR /&gt;
  | eval CNPJPDV= CNPJ."-".PDV &lt;BR /&gt;
  | appendcols [ search &lt;BR /&gt;
       index=index_cbo_pt "Scope State: 65280"&lt;BR /&gt;
       | eval CNPJPDV= CNPJ."-".PDV_PT &lt;BR /&gt;
        ] &lt;BR /&gt;
  | timechart span=1h count by PaymentChannelName&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;if the list of PaymentChannelName isn't so variable you also could extract them in a lookup by a night batch (it's surely more quick!)&lt;BR /&gt;
&lt;EM&gt;index=index_cbo_pt "Scope State: 65280" | eval CNPJPDV= CNPJ."-".PDV_PT | fields CNPJPDV PaymentChannelName&lt;/EM&gt;&lt;BR /&gt;
and then use the lookup to give the correct PaymentChannelName to every event ans so make your stats.&lt;BR /&gt;
 &lt;EM&gt;index=index_cbo "Scope State: 65280" | eval CNPJPDV= CNPJ."-".PDV | lookup yourlookup CNPJPDV OUTPUT PaymentChannelName | timechart span=1h count by PaymentChannelName&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:06:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Timechart-count-by-a-subsearch-field/m-p/208162#M60695</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T11:06:17Z</dc:date>
    </item>
  </channel>
</rss>

