<?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: Convert splunk time format to epoc time. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-splunk-time-format-to-epoc-time/m-p/321382#M161473</link>
    <description>&lt;P&gt;Try like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=mlc | eval _time = if(len(replace("$yourtoken$","\d",""))=0,$yourtoken$,relative_time(now(),"$yourtoken$")) + relative_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Basically checking if the token value is all numbers (not relative time modifier) then use the token value OR use the relative time modifier value instead.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Apr 2017 15:29:25 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-04-07T15:29:25Z</dc:date>
    <item>
      <title>Convert splunk time format to epoc time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-splunk-time-format-to-epoc-time/m-p/321381#M161472</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can we convert splunk specific time to epoc time ?&lt;/P&gt;

&lt;P&gt;For example: &lt;BR /&gt;
-4h@h   &lt;/P&gt;

&lt;P&gt;I am using a search query in which one token have value like this causing failure of that query.  &lt;/P&gt;

&lt;P&gt;Query :&lt;BR /&gt;&lt;BR /&gt;
working fine :  eventtype=mlc  | eval _time = 3423423423 + relative_time &lt;BR /&gt;
Not working :  eventtype=mlc  | eval _time = -4h@h + relative_time&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:37:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-splunk-time-format-to-epoc-time/m-p/321381#M161472</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2020-09-29T13:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert splunk time format to epoc time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-splunk-time-format-to-epoc-time/m-p/321382#M161473</link>
      <description>&lt;P&gt;Try like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=mlc | eval _time = if(len(replace("$yourtoken$","\d",""))=0,$yourtoken$,relative_time(now(),"$yourtoken$")) + relative_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Basically checking if the token value is all numbers (not relative time modifier) then use the token value OR use the relative time modifier value instead.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 15:29:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-splunk-time-format-to-epoc-time/m-p/321382#M161473</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-04-07T15:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert splunk time format to epoc time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-splunk-time-format-to-epoc-time/m-p/321383#M161474</link>
      <description>&lt;P&gt;You use the &lt;CODE&gt;relative_time()&lt;/CODE&gt; function and the &lt;CODE&gt;now()&lt;/CODE&gt; function.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Apr 2017 03:37:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-splunk-time-format-to-epoc-time/m-p/321383#M161474</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-04-08T03:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convert splunk time format to epoc time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-splunk-time-format-to-epoc-time/m-p/321384#M161475</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;. it helped me to fix the problem.&lt;BR /&gt;
the below one worked fine.&lt;BR /&gt;
eventtype=mlc | eval start_time = if(len(replace("$time_token.earliest$","\d",""))=0,"$time_token.earliest$",0) | eval _time = start_time + relative_time&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-splunk-time-format-to-epoc-time/m-p/321384#M161475</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2020-09-29T13:38:42Z</dc:date>
    </item>
  </channel>
</rss>

