<?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: Adapting a search to use timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Adapting-a-search-to-use-timechart/m-p/347009#M170273</link>
    <description>&lt;P&gt;Since you want to do timechart on calculated value after stats aggregation, you would need to do that aggregation for the time span you want to use in the timechart. E.g. If you want that RiskValueL to be calculated for every hour and show a timechart, you'd do something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=M sourcetype="n" name="M*" 
 |dedup host-ip, plugin_name, plugin_family, severity, "ports{}.port", "ports{}.transport" | eval vulhost=if (severity="critical" or severity="high" or severity="medium" or severity="low",'host-ip',null()) 
| bucket span=1h _time
| stats dc(host-ip) as TH, dc(vulhost) as VH, first(date_month) as ETime, count(eval(severity="critical")) as VH1, count(eval(severity="high")) as VH2, count(eval(severity="medium")) as VH3, count(eval(severity="low")) as VH4, count by _time | fillnull critical, high,medium,low,VH1,VH2,VH3,VH4
 |eval RiskValueL=round((VH1+0.75*VH2+0.5*VH3+0.1*VH4)/(VH1+VH2+VH3+VH4)*(VH/TH),5)
| timechart span=1h avg(RiskValueL) as RiskValueL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Basically, bucket _time with 1hr spans before stats, add _time to stats and add timechart with same span.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Apr 2018 18:42:53 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-04-17T18:42:53Z</dc:date>
    <item>
      <title>Adapting a search to use timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adapting-a-search-to-use-timechart/m-p/347007#M170271</link>
      <description>&lt;P&gt;Hello:&lt;BR /&gt;
I have the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=M sourcetype="n" name="M*" 
|dedup host-ip, plugin_name, plugin_family, severity, "ports{}.port", "ports{}.transport" | eval vulhost=if (severity="critical" or severity="high" or severity="medium" or severity="low",'host-ip',null())| stats dc(host-ip) as TH, dc(vulhost) as VH, first(date_month) as ETime, count(eval(severity="critical")) as VH1, count(eval(severity="high")) as VH2, count(eval(severity="medium")) as VH3, count(eval(severity="low")) as VH4, count | fillnull critical, high,medium,low,VH1,VH2,VH3,VH4
|eval RiskValueL=round((VH1+0.75*VH2+0.5*VH3+0.1*VH4)/(VH1+VH2+VH3+VH4)*(VH/TH),5)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have to show a timechart with the RiskValue that is calculated in the search, however if I add the timechart at the end of the search, it shows nothing. How can I modify this search to be able to visualize a timechart of the RiskValue for the past 3 months for example?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 17:10:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adapting-a-search-to-use-timechart/m-p/347007#M170271</guid>
      <dc:creator>atenciodeyka</dc:creator>
      <dc:date>2018-04-17T17:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Adapting a search to use timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adapting-a-search-to-use-timechart/m-p/347008#M170272</link>
      <description>&lt;P&gt;the &lt;CODE&gt;stats&lt;/CODE&gt; command takes the &lt;CODE&gt;_time&lt;/CODE&gt; away ...&lt;BR /&gt;
add &lt;CODE&gt;by _time&lt;/CODE&gt; at the end of your &lt;CODE&gt;stats&lt;/CODE&gt; and youll be fine&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 17:19:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adapting-a-search-to-use-timechart/m-p/347008#M170272</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-04-17T17:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Adapting a search to use timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adapting-a-search-to-use-timechart/m-p/347009#M170273</link>
      <description>&lt;P&gt;Since you want to do timechart on calculated value after stats aggregation, you would need to do that aggregation for the time span you want to use in the timechart. E.g. If you want that RiskValueL to be calculated for every hour and show a timechart, you'd do something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=M sourcetype="n" name="M*" 
 |dedup host-ip, plugin_name, plugin_family, severity, "ports{}.port", "ports{}.transport" | eval vulhost=if (severity="critical" or severity="high" or severity="medium" or severity="low",'host-ip',null()) 
| bucket span=1h _time
| stats dc(host-ip) as TH, dc(vulhost) as VH, first(date_month) as ETime, count(eval(severity="critical")) as VH1, count(eval(severity="high")) as VH2, count(eval(severity="medium")) as VH3, count(eval(severity="low")) as VH4, count by _time | fillnull critical, high,medium,low,VH1,VH2,VH3,VH4
 |eval RiskValueL=round((VH1+0.75*VH2+0.5*VH3+0.1*VH4)/(VH1+VH2+VH3+VH4)*(VH/TH),5)
| timechart span=1h avg(RiskValueL) as RiskValueL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Basically, bucket _time with 1hr spans before stats, add _time to stats and add timechart with same span.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 18:42:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adapting-a-search-to-use-timechart/m-p/347009#M170273</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-04-17T18:42:53Z</dc:date>
    </item>
  </channel>
</rss>

