<?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 extract date from filename and add it with time from event in the same file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329741#M98177</link>
    <description>&lt;P&gt;@bkumarm, glad it worked. Please up vote the comment if it helped.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jul 2017 10:53:45 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-07-26T10:53:45Z</dc:date>
    <item>
      <title>how to extract date from filename and add it with time from event in the same file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329736#M98172</link>
      <description>&lt;P&gt;We have log files with names like:  " &lt;STRONG&gt;my-file-log1.2017-07-25.name.log"&lt;/STRONG&gt;&lt;BR /&gt;
The events in the log are like this:&lt;BR /&gt;
060047.342061Z INFO ASDFTestStatusMsg::eval: Passed(123/567892)&lt;/P&gt;

&lt;P&gt;The time format in the events is: HHmmss.SSSSSS or HHmmss.SSS&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Requirement&lt;/STRONG&gt; is to add the date from filename into all the events at index time. &lt;BR /&gt;
I also need help in converting the time into proper timestamp.&lt;/P&gt;

&lt;P&gt;any solutions suggested?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Bharath&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 13:29:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329736#M98172</guid>
      <dc:creator>bkumarm</dc:creator>
      <dc:date>2017-07-25T13:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date from filename and add it with time from event in the same file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329737#M98173</link>
      <description>&lt;P&gt;I see that the  &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.4/Data/HowSplunkextractstimestamps"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.4/Data/HowSplunkextractstimestamps&lt;/A&gt;&lt;BR /&gt;
says it does by default. but it is not working for me&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 13:52:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329737#M98173</guid>
      <dc:creator>bkumarm</dc:creator>
      <dc:date>2017-07-25T13:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date from filename and add it with time from event in the same file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329738#M98174</link>
      <description>&lt;P&gt;@bkumarm, in your props.conf, have you extracted only the &lt;STRONG&gt;time&lt;/STRONG&gt; from your logs? If you have not as it is mentioned in the documentation Splunk will default time to file modified timestamp. If you extract the time properly, Splunk should be able to pull the date from the filename. Proper time format seems to be following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[&amp;lt;yourSourceTypeName&amp;gt;]
TIME_FORMAT=%H%M%S.%6N
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 15:46:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329738#M98174</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-25T15:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date from filename and add it with time from event in the same file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329739#M98175</link>
      <description>&lt;P&gt;So when you search this data you do not get the fields &lt;BR /&gt;
date_hour&lt;BR /&gt;
date_mday&lt;BR /&gt;
date_minute&lt;/P&gt;

&lt;P&gt;etc?&lt;/P&gt;

&lt;P&gt;Does adding this to your search add a new field named "indextime" ?&lt;/P&gt;

&lt;P&gt;| eval indextime=strftime(_indextime,"%Y-%m-%d %H:%M:%S") &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:03:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329739#M98175</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2020-09-29T15:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date from filename and add it with time from event in the same file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329740#M98176</link>
      <description>&lt;P&gt;Thanks Niket, your clue helped us resolve the issue.&lt;BR /&gt;
in your props.conf,  []&lt;BR /&gt;
 TIME_FORMAT=%H%M%S.%6N&lt;/P&gt;

&lt;P&gt;we had also problem in filename, that we fixed.&lt;/P&gt;

&lt;P&gt;-Bharath&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 05:58:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329740#M98176</guid>
      <dc:creator>bkumarm</dc:creator>
      <dc:date>2017-07-26T05:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date from filename and add it with time from event in the same file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329741#M98177</link>
      <description>&lt;P&gt;@bkumarm, glad it worked. Please up vote the comment if it helped.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 10:53:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-date-from-filename-and-add-it-with-time-from/m-p/329741#M98177</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-26T10:53:45Z</dc:date>
    </item>
  </channel>
</rss>

