<?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 timechart results of stats or transaction? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447134#M126782</link>
    <description>&lt;P&gt;So i finally figured it out...&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TL;DR:&lt;/STRONG&gt;  I needed to use the &lt;CODE&gt;map&lt;/CODE&gt; command to run each IP from my &lt;CODE&gt;stats&lt;/CODE&gt; results through an entirely new search to get the timechart of all events for that IP.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;* | eval eventDate=strftime(_time,"%F") | stats dc(eventDate) as dailyVisit by clientIp | where dailyVisit&amp;gt;4 | sort -dailyVisit | map search="search clientIp=$clientIp$ | timechart count by clientIp"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7505iA82423493EDF4856/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Breaking this down for anyone who cares to learn from my noob-iness...&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;CODE&gt;| eval eventDate=strftime(_time,"%F")&lt;/CODE&gt; or (from the original examples) &lt;CODE&gt;| bin span=1d _time&lt;/CODE&gt;&lt;/STRONG&gt;&lt;BR /&gt;
I needed a way to group all requests from the same day from the same IP.  Either of these will change the timestamp of the log events to a 1 day span.  So rather than &lt;STRONG&gt;7/27/19 08:53:19.253 AM&lt;/STRONG&gt; the timestamp for each log will be just &lt;STRONG&gt;7/27/19&lt;/STRONG&gt; or (in the case of the &lt;CODE&gt;bin&lt;/CODE&gt; example) &lt;STRONG&gt;7/27/19 12:00:00.000 AM&lt;/STRONG&gt;.  You can see this in the screenshots above.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;CODE&gt;| stats dc(eventDate) as dailyVisit by clientIp | where dailyVisit&amp;gt;4 | sort -dailyVisit&lt;/CODE&gt;&lt;/STRONG&gt;&lt;BR /&gt;
I now wanted to count how many diffrent days each IP has at least one log event.&lt;BR /&gt;
&lt;CODE&gt;| stats dc(eventDate) as dailyVisit by clientIp&lt;/CODE&gt; gives me a distinct count &lt;CODE&gt;dc&lt;/CODE&gt; (saved as the variable &lt;STRONG&gt;dailyVisit&lt;/STRONG&gt;) per &lt;STRONG&gt;clientIp&lt;/STRONG&gt;.&lt;BR /&gt;
&lt;CODE&gt;| where dailyVisit&amp;gt;4&lt;/CODE&gt; filters this to just the IP addresses that had more than 4 &lt;STRONG&gt;dailyVisits&lt;/STRONG&gt;.&lt;BR /&gt;
&lt;CODE&gt;| sort -dailyVisit&lt;/CODE&gt; sorts it in descending order by number of &lt;STRONG&gt;dailyVisits&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;At this point I had identified the &lt;STRONG&gt;clientIps&lt;/STRONG&gt; in question but now I wanted to graph a timechart of ALL their log events but, the results of this search string did not have all their log data.  In fact it only had two fields, &lt;STRONG&gt;clientIP&lt;/STRONG&gt; and &lt;STRONG&gt;dailyVisit&lt;/STRONG&gt;.&lt;BR /&gt;
&lt;STRONG&gt;&lt;CODE&gt;| map search="search clientIp=$clientIp$ | timechart count by clientIp"&lt;/CODE&gt;&lt;/STRONG&gt;&lt;BR /&gt;
So I needed the &lt;CODE&gt;map&lt;/CODE&gt; (&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/Map"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/Map&lt;/A&gt;) command to run each IP from the results of this search through an entirely new search to get a timechart of ALL of their log events.&lt;/P&gt;

&lt;P&gt;Hope that helps someone some day!!&lt;/P&gt;</description>
    <pubDate>Thu, 15 Aug 2019 20:07:21 GMT</pubDate>
    <dc:creator>jmartinf5</dc:creator>
    <dc:date>2019-08-15T20:07:21Z</dc:date>
    <item>
      <title>How to timechart results of stats or transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447129#M126777</link>
      <description>&lt;P&gt;I am trying to identify client IP addresses that recur across multiple days and then graph just those that meet a certain criteria (more than 4 days in my example below) over time. I have the search that identifies the IPs in question but now I am not sure how to graph just the results.&lt;/P&gt;

&lt;P&gt;Both of these give me the same, correct results...&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;* | eval eventDate=strftime(_time,"%F") | stats dc(eventDate) as dailyVisit by clientIp | where dailyVisit&amp;gt;4 | sort -dailyVisit&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;* | bin span=1d _time | transaction clientIp _time | stats count(_time) as dailyVisit by clientIp | where dailyVisit&amp;gt;4 | sort -dailyVisit&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/273477-splunk-table.png" alt="alt text" /&gt;&lt;BR /&gt;
...but timechart won't run on them.&lt;/P&gt;

&lt;P&gt;I have also tried to use just transaction and sort descending by count but it seems to list/graph them by random IP and not by number of transactions per IP&lt;BR /&gt;
&lt;CODE&gt;* | eval eventDate=strftime(_time,"%F") | transaction clientIp eventDate maxspan=1day | sort -count | timechart count by clientIp useother=false&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Any idea on how to build a timechart of the events from just the IP addresses in either of the first two examples over time???&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:44:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447129#M126777</guid>
      <dc:creator>jmartinf5</dc:creator>
      <dc:date>2020-09-30T01:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to timechart results of stats or transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447130#M126778</link>
      <description>&lt;P&gt;you should try &lt;CODE&gt;where&lt;/CODE&gt; clause with &lt;CODE&gt;timechart&lt;/CODE&gt;&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/timechart#Where_clause_examples"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/timechart#Where_clause_examples&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.. | eval eventDate=strftime(_time,"%F") | timechart useother=f usenull=f span=1d dc(eventDate)  by clientIp where dc &amp;gt; 3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 17:41:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447130#M126778</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-08-14T17:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to timechart results of stats or transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447131#M126779</link>
      <description>&lt;P&gt;No go.  It still graphs IPs that did not have more than 4 visits.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7504iE8E9D5146B719F80/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 18:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447131#M126779</guid>
      <dc:creator>jmartinf5</dc:creator>
      <dc:date>2019-08-14T18:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to timechart results of stats or transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447132#M126780</link>
      <description>&lt;P&gt;oops I just modified my answer. It should be &lt;CODE&gt;dc&lt;/CODE&gt; and not &lt;CODE&gt;eventDate&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 18:51:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447132#M126780</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-08-14T18:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to timechart results of stats or transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447133#M126781</link>
      <description>&lt;P&gt;that didn't work either but I did figure it out.  See my answer below.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 13:55:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447133#M126781</guid>
      <dc:creator>jmartinf5</dc:creator>
      <dc:date>2019-08-15T13:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to timechart results of stats or transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447134#M126782</link>
      <description>&lt;P&gt;So i finally figured it out...&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TL;DR:&lt;/STRONG&gt;  I needed to use the &lt;CODE&gt;map&lt;/CODE&gt; command to run each IP from my &lt;CODE&gt;stats&lt;/CODE&gt; results through an entirely new search to get the timechart of all events for that IP.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;* | eval eventDate=strftime(_time,"%F") | stats dc(eventDate) as dailyVisit by clientIp | where dailyVisit&amp;gt;4 | sort -dailyVisit | map search="search clientIp=$clientIp$ | timechart count by clientIp"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7505iA82423493EDF4856/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Breaking this down for anyone who cares to learn from my noob-iness...&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;CODE&gt;| eval eventDate=strftime(_time,"%F")&lt;/CODE&gt; or (from the original examples) &lt;CODE&gt;| bin span=1d _time&lt;/CODE&gt;&lt;/STRONG&gt;&lt;BR /&gt;
I needed a way to group all requests from the same day from the same IP.  Either of these will change the timestamp of the log events to a 1 day span.  So rather than &lt;STRONG&gt;7/27/19 08:53:19.253 AM&lt;/STRONG&gt; the timestamp for each log will be just &lt;STRONG&gt;7/27/19&lt;/STRONG&gt; or (in the case of the &lt;CODE&gt;bin&lt;/CODE&gt; example) &lt;STRONG&gt;7/27/19 12:00:00.000 AM&lt;/STRONG&gt;.  You can see this in the screenshots above.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;CODE&gt;| stats dc(eventDate) as dailyVisit by clientIp | where dailyVisit&amp;gt;4 | sort -dailyVisit&lt;/CODE&gt;&lt;/STRONG&gt;&lt;BR /&gt;
I now wanted to count how many diffrent days each IP has at least one log event.&lt;BR /&gt;
&lt;CODE&gt;| stats dc(eventDate) as dailyVisit by clientIp&lt;/CODE&gt; gives me a distinct count &lt;CODE&gt;dc&lt;/CODE&gt; (saved as the variable &lt;STRONG&gt;dailyVisit&lt;/STRONG&gt;) per &lt;STRONG&gt;clientIp&lt;/STRONG&gt;.&lt;BR /&gt;
&lt;CODE&gt;| where dailyVisit&amp;gt;4&lt;/CODE&gt; filters this to just the IP addresses that had more than 4 &lt;STRONG&gt;dailyVisits&lt;/STRONG&gt;.&lt;BR /&gt;
&lt;CODE&gt;| sort -dailyVisit&lt;/CODE&gt; sorts it in descending order by number of &lt;STRONG&gt;dailyVisits&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;At this point I had identified the &lt;STRONG&gt;clientIps&lt;/STRONG&gt; in question but now I wanted to graph a timechart of ALL their log events but, the results of this search string did not have all their log data.  In fact it only had two fields, &lt;STRONG&gt;clientIP&lt;/STRONG&gt; and &lt;STRONG&gt;dailyVisit&lt;/STRONG&gt;.&lt;BR /&gt;
&lt;STRONG&gt;&lt;CODE&gt;| map search="search clientIp=$clientIp$ | timechart count by clientIp"&lt;/CODE&gt;&lt;/STRONG&gt;&lt;BR /&gt;
So I needed the &lt;CODE&gt;map&lt;/CODE&gt; (&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/Map"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/Map&lt;/A&gt;) command to run each IP from the results of this search through an entirely new search to get a timechart of ALL of their log events.&lt;/P&gt;

&lt;P&gt;Hope that helps someone some day!!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 20:07:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447134#M126782</guid>
      <dc:creator>jmartinf5</dc:creator>
      <dc:date>2019-08-15T20:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to timechart results of stats or transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447135#M126783</link>
      <description>&lt;P&gt;Do not use &lt;CODE&gt;map&lt;/CODE&gt;, do it with a &lt;CODE&gt;subsearch&lt;/CODE&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... AND [ ... | eval eventDate=strftime(_time,"%F") | stats dc(eventDate) as dailyVisit BY clientIp | where dailyVisit&amp;gt;4 | table clientip ] 
| timechart count by clientIp"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Aug 2019 16:27:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447135#M126783</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-16T16:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to timechart results of stats or transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447136#M126784</link>
      <description>&lt;P&gt;Do not use &lt;CODE&gt;map&lt;/CODE&gt;, do it with a &lt;CODE&gt;subsearch&lt;/CODE&gt; like my new answer shows.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 16:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447136#M126784</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-16T16:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to timechart results of stats or transaction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447137#M126785</link>
      <description>&lt;P&gt;OK, that worked and seems to be cleaner and certainly runs faster.  Thank you!!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 19:00:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-timechart-results-of-stats-or-transaction/m-p/447137#M126785</guid>
      <dc:creator>jmartinf5</dc:creator>
      <dc:date>2019-08-16T19:00:26Z</dc:date>
    </item>
  </channel>
</rss>

