<?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 Conditional find and replace in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Conditional-find-and-replace/m-p/413838#M119255</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a question on a conditional find and replace. I have a query that calculates a mean for the different hours on the different days. This query looks like this: &lt;/P&gt;

&lt;P&gt;index=index1 adapter_name=ABSAdapter earliest=-90d &lt;BR /&gt;
| timechart span="1h" sum(number_of_records) as aantal &lt;BR /&gt;
| eval time=strftime(_time,"%w%H") &lt;BR /&gt;
| eventstats mean(aantal) as meanAantal, stdev(aantal) as stdAantal by time &lt;BR /&gt;
| where (aantal&amp;gt;(meanAantal + (stdAantal * -3)) AND aantal&amp;lt;(meanAantal + (stdAantal * 3)))&lt;BR /&gt;
| stats mean(aantal) as threshold by time&lt;BR /&gt;
| eventstats mean(threshold) as overalMean&lt;BR /&gt;
| table threshold, time, overalMean&lt;/P&gt;

&lt;P&gt;Now I also want to find and replace threshold values that are under a certain value to 0. The condition should be something like: &lt;/P&gt;

&lt;P&gt;if(threshold &amp;lt; overalMean*0.20) --&amp;gt; threshold = 0&lt;BR /&gt;
else --&amp;gt; threshold = threshold&lt;/P&gt;

&lt;P&gt;Does anyone know how to do this? &lt;/P&gt;

&lt;P&gt;Thanks in advance and kind regards,&lt;BR /&gt;
Willem&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 01:30:37 GMT</pubDate>
    <dc:creator>willemjongeneel</dc:creator>
    <dc:date>2020-09-30T01:30:37Z</dc:date>
    <item>
      <title>Conditional find and replace</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-find-and-replace/m-p/413838#M119255</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a question on a conditional find and replace. I have a query that calculates a mean for the different hours on the different days. This query looks like this: &lt;/P&gt;

&lt;P&gt;index=index1 adapter_name=ABSAdapter earliest=-90d &lt;BR /&gt;
| timechart span="1h" sum(number_of_records) as aantal &lt;BR /&gt;
| eval time=strftime(_time,"%w%H") &lt;BR /&gt;
| eventstats mean(aantal) as meanAantal, stdev(aantal) as stdAantal by time &lt;BR /&gt;
| where (aantal&amp;gt;(meanAantal + (stdAantal * -3)) AND aantal&amp;lt;(meanAantal + (stdAantal * 3)))&lt;BR /&gt;
| stats mean(aantal) as threshold by time&lt;BR /&gt;
| eventstats mean(threshold) as overalMean&lt;BR /&gt;
| table threshold, time, overalMean&lt;/P&gt;

&lt;P&gt;Now I also want to find and replace threshold values that are under a certain value to 0. The condition should be something like: &lt;/P&gt;

&lt;P&gt;if(threshold &amp;lt; overalMean*0.20) --&amp;gt; threshold = 0&lt;BR /&gt;
else --&amp;gt; threshold = threshold&lt;/P&gt;

&lt;P&gt;Does anyone know how to do this? &lt;/P&gt;

&lt;P&gt;Thanks in advance and kind regards,&lt;BR /&gt;
Willem&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:30:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-find-and-replace/m-p/413838#M119255</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2020-09-30T01:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional find and replace</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-find-and-replace/m-p/413839#M119256</link>
      <description>&lt;P&gt;I got this working just after I asked the question... &lt;/P&gt;

&lt;P&gt;Solution: | eval threshold=case(threshold &amp;lt; overalMean*0.05, 0, threshold &amp;gt; overalMean*0.05, threshold) &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:30:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-find-and-replace/m-p/413839#M119256</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2020-09-30T01:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional find and replace</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-find-and-replace/m-p/413840#M119257</link>
      <description>&lt;P&gt;I got this working just after I asked the question...&lt;/P&gt;

&lt;P&gt;Solution: | eval threshold=case(threshold &amp;lt; overalMean*0.05, 0, threshold &amp;gt; overalMean*0.05, threshold) &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:30:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-find-and-replace/m-p/413840#M119257</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2020-09-30T01:30:42Z</dc:date>
    </item>
  </channel>
</rss>

