<?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: get timestamp from filename in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/get-timestamp-from-filename/m-p/57470#M11226</link>
    <description>&lt;P&gt;Thanks, I did set TIME_PREFIX and TIME_FORMAT so that splunk did not find any ts into the event itself. It does backup on the file update time, which is fine.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 13:01:02 GMT</pubDate>
    <dc:creator>olivier_romain</dc:creator>
    <dc:date>2020-09-28T13:01:02Z</dc:date>
    <item>
      <title>get timestamp from filename</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/get-timestamp-from-filename/m-p/57468#M11224</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;

&lt;P&gt;I am trying to retreive timestamp from filename. I have files named like &lt;/P&gt;

&lt;P&gt;"disco_20120531.txt"&lt;/P&gt;

&lt;P&gt;with content looking like:&lt;/P&gt;

&lt;P&gt;"net0 family 'Web' application 'videosurf' path 'base.eth.8021q.ip.gre.ppp.ip.tcp.http.videosurf' rate 0 totbytes 25664 nb_packet 231 nb_uapp_cnx 25"&lt;/P&gt;

&lt;P&gt;I try to set timestamp from filename "disco_20120531.txt" to 31/05/2012&lt;/P&gt;

&lt;P&gt;However I couldn't make it. My app props.conf :&lt;/P&gt;

&lt;P&gt;[source::/root/data/disco/daily/*]&lt;BR /&gt;
NO_BINARY_CHECK = 1&lt;BR /&gt;
SHOULD_LINEMERGE = false&lt;BR /&gt;
pulldown_type = 1&lt;BR /&gt;
TIME_PREFIX = disco_&lt;BR /&gt;
TIME_FORMAT = %Y%m%d&lt;/P&gt;

&lt;P&gt;This config works if the filename is added to the file content, but otherwise not. Time stamp is not found and splunk uses file mod time instead.&lt;/P&gt;

&lt;P&gt;Does anyone has got an idea what's wrong?&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;

&lt;P&gt;Olivier&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:55:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/get-timestamp-from-filename/m-p/57468#M11224</guid>
      <dc:creator>olivier_romain</dc:creator>
      <dc:date>2020-09-28T12:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: get timestamp from filename</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/get-timestamp-from-filename/m-p/57469#M11225</link>
      <description>&lt;P&gt;From the Splunk documentation &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/Data/HowSplunkextractstimestamps"&gt;here&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;"4. If no events in a source have a date, Splunk tries to find one in the source name or file name. (This requires that the events have a time, even though they don't have a date.)"&lt;/P&gt;

&lt;P&gt;TIME_PREFIX and TIME_FORMAT are not used when parsing the date in a file name. They apply only when extracting the timestamp from an event.&lt;/P&gt;

&lt;P&gt;Bottom line: Splunk will use your file modification date/time. I don't know any way around this, but perhaps someone else on this forum does. Or you could open a support ticket... The best option, if possible, is to add a full timestamp to every event.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2012 02:29:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/get-timestamp-from-filename/m-p/57469#M11225</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-12-09T02:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: get timestamp from filename</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/get-timestamp-from-filename/m-p/57470#M11226</link>
      <description>&lt;P&gt;Thanks, I did set TIME_PREFIX and TIME_FORMAT so that splunk did not find any ts into the event itself. It does backup on the file update time, which is fine.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:01:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/get-timestamp-from-filename/m-p/57470#M11226</guid>
      <dc:creator>olivier_romain</dc:creator>
      <dc:date>2020-09-28T13:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: get timestamp from filename</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/get-timestamp-from-filename/m-p/57471#M11227</link>
      <description>&lt;P&gt;Hi Lisa,&lt;BR /&gt;
I have the same problem too in Splunk 6.1, as many others, for a quite important prospect. I also had as last resort the idea of adding at the beginning of the _raw data the timestamp extracted from the source file, with date and time of the generation of the informations.&lt;/P&gt;

&lt;P&gt;I only have a doubt: isn't timestamp assigned during the parsing phase before the Custom configurations in props.conf, like transforms and so on? We tried that but with no results...&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Marco&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 10:25:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/get-timestamp-from-filename/m-p/57471#M11227</guid>
      <dc:creator>marcoscala</dc:creator>
      <dc:date>2014-05-15T10:25:32Z</dc:date>
    </item>
  </channel>
</rss>

