<?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 compare two weeks ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147613#M41252</link>
    <description>&lt;P&gt;Hi falcom92,&lt;/P&gt;

&lt;P&gt;use the &lt;CODE&gt;timewrap&lt;/CODE&gt; app &lt;A href="https://apps.splunk.com/app/1645"&gt;https://apps.splunk.com/app/1645&lt;/A&gt; which will handle such things or take a look at this answer &lt;A href="http://answers.splunk.com/answers/185829/how-to-create-a-custom-macro-function-inside-the-s.html"&gt;http://answers.splunk.com/answers/185829/how-to-create-a-custom-macro-function-inside-the-s.html&lt;/A&gt; to get an idea how it can be done using some &lt;CODE&gt;stats&lt;/CODE&gt; commands.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Fri, 20 Feb 2015 12:27:51 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2015-02-20T12:27:51Z</dc:date>
    <item>
      <title>How to compare two weeks ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147612#M41251</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I use Splunk 6.2.&lt;/P&gt;

&lt;P&gt;I try to compare two values between two differents weeks. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="market_logs" host="12.0.0.1" OR host="12.0.0.2" 
AND status="rejected" OR status="error" 
AND srcip="192.168.0.1" OR srcip="192.168.0.2"
| eval r_before =
    [search index="market_logs" host="12.0.0.1" OR host="12.0.0.2" 
    AND status="rejected" OR status="error" 
    AND srcip="192.168.0.1" OR srcip="192.168.0.2" 
    earliest=-14d@h latest=-7d@h
    | stats count] 
| stats count AS r_now
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it doesn't work. I have the following error : "Error in 'eval' command: Fields cannot be assigned a boolean result. Instead, try if([bool expr], [expr], [expr])."&lt;/P&gt;

&lt;P&gt;I use a script who extract the two values.&lt;/P&gt;

&lt;P&gt;Can someone help me please ?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;falcom92&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2015 10:59:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147612#M41251</guid>
      <dc:creator>falcom92</dc:creator>
      <dc:date>2015-02-20T10:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two weeks ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147613#M41252</link>
      <description>&lt;P&gt;Hi falcom92,&lt;/P&gt;

&lt;P&gt;use the &lt;CODE&gt;timewrap&lt;/CODE&gt; app &lt;A href="https://apps.splunk.com/app/1645"&gt;https://apps.splunk.com/app/1645&lt;/A&gt; which will handle such things or take a look at this answer &lt;A href="http://answers.splunk.com/answers/185829/how-to-create-a-custom-macro-function-inside-the-s.html"&gt;http://answers.splunk.com/answers/185829/how-to-create-a-custom-macro-function-inside-the-s.html&lt;/A&gt; to get an idea how it can be done using some &lt;CODE&gt;stats&lt;/CODE&gt; commands.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2015 12:27:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147613#M41252</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-02-20T12:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two weeks ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147614#M41253</link>
      <description>&lt;P&gt;I find the solution with &lt;CODE&gt;append&lt;/CODE&gt; and it works.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="market_logs" host="12.0.0.1" OR host="12.0.0.2"
AND status="rejected" OR status="error"
AND srcip="192.168.0.1" OR srcip="192.168.0.2"
| stats count
| append [search index="market_logs" host="12.0.0.1" OR host="12.0.0.2"
AND status="rejected" OR status="error"
AND srcip="192.168.0.1" OR srcip="192.168.0.2"
earliest=-14d@h latest=-7d@h
| stats count]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Feb 2015 09:28:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147614#M41253</guid>
      <dc:creator>falcom92</dc:creator>
      <dc:date>2015-02-25T09:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two weeks ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147615#M41254</link>
      <description>&lt;P&gt;Hi Falcom,&lt;BR /&gt;
For ease of use I'd recommend the timewrap app, it adds an extra command/function to the search which lets you set a span, either by day, by week, by month for 1 search, which could help improve search speeds.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Feb 2015 09:49:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147615#M41254</guid>
      <dc:creator>markthompson</dc:creator>
      <dc:date>2015-02-25T09:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two weeks ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147616#M41255</link>
      <description>&lt;P&gt;I second this or use &lt;CODE&gt;stats&lt;/CODE&gt; which will out-perform anything else - especially on long runs over a bigger time range.&lt;BR /&gt;
Any kind of sub search such be your last resort not your first choice ....&lt;/P&gt;</description>
      <pubDate>Wed, 25 Feb 2015 09:54:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-weeks/m-p/147616#M41255</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-02-25T09:54:49Z</dc:date>
    </item>
  </channel>
</rss>

