<?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: date conversion in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194673#M56139</link>
    <description>&lt;P&gt;So are you getting the correct strptime?&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jan 2014 09:27:51 GMT</pubDate>
    <dc:creator>linu1988</dc:creator>
    <dc:date>2014-01-06T09:27:51Z</dc:date>
    <item>
      <title>date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194668#M56134</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
There's a problem in displaying abbreivated month and year when using the below search query&lt;/P&gt;

&lt;P&gt;source="RSBA_LOGS2" | rex ":(?&lt;TIMESTAMP&gt;\S+)\s" | eval n=strptime(timestamp,"%b%Y") | table n&lt;/TIMESTAMP&gt;&lt;/P&gt;

&lt;P&gt;Input: &lt;BR /&gt;
2013-12-09 18:11:34&lt;/P&gt;

&lt;P&gt;Desired output : &lt;BR /&gt;
Dec 12 2013&lt;/P&gt;

&lt;P&gt;Please advise.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 09:17:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194668#M56134</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-03T09:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194669#M56135</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
You would need to query like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="RSBA_LOGS2" | rex field=_raw "(?i)\.log:(?P&amp;lt;timestamp&amp;gt;[^,]+)" | eval m=strptime(timestamp,"%Y-%m-%d")|eval timestamp=strftime(m,"%B %Y")|table timestamp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 11:08:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194669#M56135</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-03T11:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194670#M56136</link>
      <description>&lt;P&gt;I am getting no results after running this search query.Can you please resolve&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 11:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194670#M56136</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-03T11:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194671#M56137</link>
      <description>&lt;P&gt;What linu1988 describes is the correct method. However, there is a slight error in the &lt;CODE&gt;rex&lt;/CODE&gt; statement, where the backslashes are missing, probably through a copy-paste error. The following is probably more correct;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;rex ":(?&amp;lt;timestamp&amp;gt;\S+)\s"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;But you should also verify that the &lt;CODE&gt;rex&lt;/CODE&gt; actually extracts the correct part of your events - otherwise the &lt;CODE&gt;strptime/strftime&lt;/CODE&gt; functions won't work.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 13:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194671#M56137</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2014-01-03T13:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194672#M56138</link>
      <description>&lt;P&gt;i tried with what you said kristian.it's extracting the corect part of timestamp from the log.But timestamp=strftime(m,"%b %d %Y")is not working properly i think and so i am getting no results.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 07:49:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194672#M56138</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-06T07:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194673#M56139</link>
      <description>&lt;P&gt;So are you getting the correct strptime?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 09:27:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194673#M56139</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-06T09:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194674#M56140</link>
      <description>&lt;P&gt;No i have problem with the statement  timestamp=strftime(m,"%b %d %Y") i couldn't derive both strptime(timestamp,"%Y-%m-%d") and strftime(m,"%b %d %Y") so i m getting no result&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 10:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194674#M56140</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-06T10:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194675#M56141</link>
      <description>&lt;P&gt;could you provide us a sample log file?&lt;BR /&gt;
we could see the extraction derive the timestamp.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 11:05:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194675#M56141</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-06T11:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194676#M56142</link>
      <description>&lt;P&gt;20131209.dbg-11-trc-0.log:2013-12-09 17:52:04,021 [13771377]    SUCCESS:    Scan successful&lt;BR /&gt;
I want the result&lt;BR /&gt;
     timestamp&lt;BR /&gt;
   november 2013&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 12:31:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194676#M56142</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-06T12:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194677#M56143</link>
      <description>&lt;P&gt;In your case splunk should automatically retrieve the timestamp from the log details. Even if you want to get it manually the search should be like the above one. I have updated the query in the answer. I am not aware if you are dividing the events or not, the timestamp can also be extracted from the log itself to assign it to the event time.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 13:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194677#M56143</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-06T13:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194678#M56144</link>
      <description>&lt;P&gt;Thank you it is working.Can you explain search query completely.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 13:41:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194678#M56144</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-06T13:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194679#M56145</link>
      <description>&lt;P&gt;You can create your own regex statement or you can use splunk's exact field option to get the same. I have used it to get the value.&lt;/P&gt;

&lt;P&gt;Please mark it as an answer if it solved your problem.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 14:37:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194679#M56145</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-06T14:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194680#M56146</link>
      <description>&lt;P&gt;Can you explain the part rex field=_raw "(?i).log:(?P&lt;TIMESTAMP&gt;[^,]+)"  of regex&lt;/TIMESTAMP&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2014 05:02:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194680#M56146</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-07T05:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: date conversion</title>
      <link>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194681#M56147</link>
      <description>&lt;P&gt;can you suggest a way on how to convert timestamp of the below log&lt;BR /&gt;
Input :2013-12-09 18:11:34&lt;BR /&gt;
Input :13-12-09 18:11:34&lt;BR /&gt;
I want a common regex to convert the above format to the below format&lt;BR /&gt;
Output:Thu December 2013 12 18:11:34.&lt;BR /&gt;
I tried with the regex you told previously as | eval m=strptime(timestamp,"%Y-%m-%d")|eval timestamp=strftime(m,"%B %Y")|table timestamp&lt;BR /&gt;
But it is converting only the timestamp with the format 2013-12-09 18:11:34 and not 13-12-09 18:11:34.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2014 09:55:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/date-conversion/m-p/194681#M56147</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-17T09:55:14Z</dc:date>
    </item>
  </channel>
</rss>

