<?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 subtract &amp;quot;(10-JAN-2012) -(11-JAN-2010) &amp;quot; in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-quot-10-JAN-2012-11-JAN-2010-quot/m-p/65602#M180392</link>
    <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;Not sure about your question, i.e. exactly what you want to subtract, but with &lt;CODE&gt;eval&lt;/CODE&gt;, you can accomplish at least the following type of calculations. Since I didn't have your data, I had to manufacture it ( the first 4 rows). The &lt;CODE&gt;table&lt;/CODE&gt; at the end shows all numbers/fields involved. The &lt;CODE&gt;diff&lt;/CODE&gt; (in seconds) is equal to 1 day.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main
| head 1 
| eval j1="10-JAN-2012" 
| eval j2="11-JAN-2012" 
| eval d1=strptime(j1,"%d-%b-%Y") 
| eval d2=strptime(j2,"%d-%b-%Y") 
| eval diff = d2-d1 
| table j1 j2 d1 d2 diff 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;

&lt;P&gt;Don't be afraid to post some sample events. You'd be able to get better help that way.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Mar 2013 09:37:48 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2013-03-19T09:37:48Z</dc:date>
    <item>
      <title>How to subtract "(10-JAN-2012) -(11-JAN-2010) "</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-quot-10-JAN-2012-11-JAN-2010-quot/m-p/65601#M180391</link>
      <description>&lt;P&gt;Here JAN is String so we can not subtract... is there any command which converts JAN to 1 or FEB to 2 so on please help me out....&lt;/P&gt;

&lt;P&gt;i have tried with "Convert" command but i am not getting it &lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2013 08:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-quot-10-JAN-2012-11-JAN-2010-quot/m-p/65601#M180391</guid>
      <dc:creator>renuka13</dc:creator>
      <dc:date>2013-03-19T08:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract "(10-JAN-2012) -(11-JAN-2010) "</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-quot-10-JAN-2012-11-JAN-2010-quot/m-p/65602#M180392</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;Not sure about your question, i.e. exactly what you want to subtract, but with &lt;CODE&gt;eval&lt;/CODE&gt;, you can accomplish at least the following type of calculations. Since I didn't have your data, I had to manufacture it ( the first 4 rows). The &lt;CODE&gt;table&lt;/CODE&gt; at the end shows all numbers/fields involved. The &lt;CODE&gt;diff&lt;/CODE&gt; (in seconds) is equal to 1 day.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main
| head 1 
| eval j1="10-JAN-2012" 
| eval j2="11-JAN-2012" 
| eval d1=strptime(j1,"%d-%b-%Y") 
| eval d2=strptime(j2,"%d-%b-%Y") 
| eval diff = d2-d1 
| table j1 j2 d1 d2 diff 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;

&lt;P&gt;Don't be afraid to post some sample events. You'd be able to get better help that way.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2013 09:37:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-quot-10-JAN-2012-11-JAN-2010-quot/m-p/65602#M180392</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-03-19T09:37:48Z</dc:date>
    </item>
  </channel>
</rss>

