<?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 How to change time in the index from 2 different date/time strings in the log? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-time-in-the-index-from-2-different-date-time/m-p/374835#M110175</link>
    <description>&lt;P&gt;Forgive me if this question has been asked before but I couldn't find the answer and I'm a little confused. &lt;/P&gt;

&lt;P&gt;I have the following TXT log file line, from which I need to compose a solid timestamp for Splunk:&lt;BR /&gt;
Date opened: &lt;STRONG&gt;12/02/2015&lt;/STRONG&gt; 12:00:00 AM, Time opened: &lt;STRONG&gt;1600&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;How can I combine into a timestamp transform the data in the index like the following:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;12/02/2015 4:00 PM&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I've tried the following REGEX:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^[\n\r].Date opened:\s((\d{2})\/(\d{2})\/(\d{4})\s)| Time opened:\s(\d{4})
FORMAT = $2/$3/$4 $5
DEST_KEY = _raw   &amp;lt;----------  Would change the original log file
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help is appreciated, &lt;/P&gt;

&lt;P&gt;Thanks, &lt;/P&gt;

&lt;P&gt;Claudio &lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 21:07:44 GMT</pubDate>
    <dc:creator>claudiocruz</dc:creator>
    <dc:date>2018-02-13T21:07:44Z</dc:date>
    <item>
      <title>How to change time in the index from 2 different date/time strings in the log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-time-in-the-index-from-2-different-date-time/m-p/374835#M110175</link>
      <description>&lt;P&gt;Forgive me if this question has been asked before but I couldn't find the answer and I'm a little confused. &lt;/P&gt;

&lt;P&gt;I have the following TXT log file line, from which I need to compose a solid timestamp for Splunk:&lt;BR /&gt;
Date opened: &lt;STRONG&gt;12/02/2015&lt;/STRONG&gt; 12:00:00 AM, Time opened: &lt;STRONG&gt;1600&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;How can I combine into a timestamp transform the data in the index like the following:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;12/02/2015 4:00 PM&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I've tried the following REGEX:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^[\n\r].Date opened:\s((\d{2})\/(\d{2})\/(\d{4})\s)| Time opened:\s(\d{4})
FORMAT = $2/$3/$4 $5
DEST_KEY = _raw   &amp;lt;----------  Would change the original log file
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help is appreciated, &lt;/P&gt;

&lt;P&gt;Thanks, &lt;/P&gt;

&lt;P&gt;Claudio &lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 21:07:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-time-in-the-index-from-2-different-date-time/m-p/374835#M110175</guid>
      <dc:creator>claudiocruz</dc:creator>
      <dc:date>2018-02-13T21:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to change time in the index from 2 different date/time strings in the log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-time-in-the-index-from-2-different-date-time/m-p/374836#M110176</link>
      <description>&lt;P&gt;Try this  slightly more efficient regex string.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^Date opened:\s(\d{2})\/(\d{2})\/(\d{4})\s[^,]+,\sTime opened:\s*(\d{4})
FORMAT = $1/$2/$3 $4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You may still end up with a non-standard timestamp.  If so, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = ^Date opened:\s(\d{2})\/(\d{2})\/(\d{4})\s[^,]+,\sTime opened:\s*(\d{2})(\d{2})
FORMAT = $1/$2/$3 $4:$5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Feb 2018 22:19:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-time-in-the-index-from-2-different-date-time/m-p/374836#M110176</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-02-13T22:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to change time in the index from 2 different date/time strings in the log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-time-in-the-index-from-2-different-date-time/m-p/374837#M110177</link>
      <description>&lt;P&gt;The Timestamp extractions happens before a TRANSFORMS (SEDCMD) is applied, so your change in the raw data would not affect the timestamp extraction. Assuming every event have same &lt;CODE&gt;12:00:00 AM, Time opened:&lt;/CODE&gt; after the date, you could configure your timestamp extraction configuration for your sourcetype (props.conf in Indexer/heavy forwarder whichever comes first) as follows&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourSourceType]
...put your line breaking configuration here..
TIME_PREFIX = ^Date opened:\s+
TIME_FORMAT = %d/%m/%Y 12:00:00 AM, Time opened: %H%M
MAX_TIMESTAMP_LOOKAHEAD =42
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Feb 2018 22:20:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-time-in-the-index-from-2-different-date-time/m-p/374837#M110177</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-02-13T22:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to change time in the index from 2 different date/time strings in the log?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-time-in-the-index-from-2-different-date-time/m-p/374838#M110178</link>
      <description>&lt;P&gt;I don't think this will work if the &lt;CODE&gt;12:00:00 AM&lt;/CODE&gt; is not a fixed time. If it is anything but that exact string the parsing will not work. Perhaps Rich's is the better one to use.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 23:06:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-time-in-the-index-from-2-different-date-time/m-p/374838#M110178</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-02-13T23:06:54Z</dc:date>
    </item>
  </channel>
</rss>

