<?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 the timestamp from a filename at index-time to use as _time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204150#M59324</link>
    <description>&lt;P&gt;Search for &lt;CODE&gt;datetime.xml&lt;/CODE&gt;.  It is not necessary but everybody uses that same filename.  Learn from working examples posted on the internet.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2017 15:45:42 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-03-02T15:45:42Z</dc:date>
    <item>
      <title>How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204140#M59314</link>
      <description>&lt;P&gt;I have searched answers high &amp;amp; low to try and extract the timestamp from my filename at index-time, but I'm still unable to get the timestamp from the filename used as _time.&lt;/P&gt;

&lt;P&gt;Summary:&lt;BR /&gt;
 - The filename contains a timetamp in &lt;CODE&gt;%Y%m%d%H%M&lt;/CODE&gt; format (&lt;CODE&gt;myfile_201510210345.txt&lt;/CODE&gt;)&lt;BR /&gt;
 - While the events in the file do contain a date, this is not the date I want to use for the timestamp.&lt;BR /&gt;
 - Sample data: [IP|1.2.3.4/32|proxy|75|||&lt;STRONG&gt;2015/10/19&lt;/STRONG&gt;|some server hostname: server]&lt;/P&gt;

&lt;P&gt;I have read the blog post as well as numerous other answers regarding custom datetime.xml usage, but I still cannot seem to crack this nut - each time it indexes using the server time (last resort in the timestamp handling). I have tried adding these definitions to a copy of the original datetime.conf as well as creating a blank datetime.conf with only these definitions in it - neither worked.&lt;/P&gt;

&lt;P&gt;My &lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mysource]
DATETIME_CONFIG = /etc/apps/myapp/local/datetime.xml
FIELD_DELIMITER = |
FIELD_NAMES = F1,F2,F3,F4,F5,F6,F7,F8
TIME_FORMAT = %Y%m%d%H%M
TZ = UTC
NO_BINARY_CHECK = true
SHOULD_LINEMERGE = false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My &lt;STRONG&gt;datetime.xml&lt;/STRONG&gt; modifications (attempt 1 - extracting date &amp;amp; time together)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;define name="_mydatetime" extract="year, month, day, hour, minute"&amp;gt;
        &amp;lt;text&amp;gt;&amp;lt;![CDATA[(?:^|source:).*?.*?(20\d\d)(0\d|1[012])([012]\d|3[01])([01]\d|2[0123])([0-6]\d)]]&amp;gt;&amp;lt;/text&amp;gt;
&amp;lt;/define&amp;gt;

&amp;lt;timePatterns&amp;gt;
  &amp;lt;use name="_mydatetime"/&amp;gt;
&amp;lt;/timePatterns&amp;gt;

&amp;lt;datePatterns&amp;gt;
  &amp;lt;use name="_mydatetime"/&amp;gt;
&amp;lt;/datePatterns&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My &lt;STRONG&gt;datetime.xml&lt;/STRONG&gt; modifications (attempt 2 - extracting date &amp;amp; time separately after reading another answers example)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;define name="_mydate" extract="year, month, day"&amp;gt;
        &amp;lt;text&amp;gt;&amp;lt;![CDATA[(?:^|source:).*?.*?(20\d\d)(0\d|1[012])([012]\d|3[01])(?:[01]\d|2[0123])(?:[0-6]\d)]]&amp;gt;&amp;lt;/text&amp;gt;
&amp;lt;/define&amp;gt;

&amp;lt;define name="_mytime" extract="hour, minute"&amp;gt;
        &amp;lt;text&amp;gt;&amp;lt;![CDATA[(?:^|source:).*?.*?(?:20\d\d)(?:0\d|1[012])(?:[012]\d|3[01])([01]\d|2[0123])([0-6]\d)]]&amp;gt;&amp;lt;/text&amp;gt;
&amp;lt;/define&amp;gt;

&amp;lt;timePatterns&amp;gt;
  &amp;lt;use name="_mydate"/&amp;gt;
&amp;lt;/timePatterns&amp;gt;

&amp;lt;datePatterns&amp;gt;
  &amp;lt;use name="_mytime"/&amp;gt;
&amp;lt;/datePatterns&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There has been a lot of answers questions about datetime.xml and also about date / time from filenames - but there does not appear to be a lot of definitive answers. Can anyone who is successfully extracting date / time stamp from the filename provide a working example of using the source at index time for this timestamp, I have been trying to get this working on &amp;amp; off for a long time now.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Ash&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 23:08:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204140#M59314</guid>
      <dc:creator>ahartge</dc:creator>
      <dc:date>2015-10-22T23:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204141#M59315</link>
      <description>&lt;P&gt;I have also tried this on 6.2.3 &amp;amp; 6.3 with no success in either version.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 01:27:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204141#M59315</guid>
      <dc:creator>ahartge</dc:creator>
      <dc:date>2015-10-23T01:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204142#M59316</link>
      <description>&lt;P&gt;I ran the import while splunk was running in debug mode &amp;amp; it appears to pull out the config ok (I updated the regex based off some other answers questions) - confirmed it matches on regex101&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10-23-2015 12:36:49.101 DEBUG FilesystemFilter - Testing path=/sourcedata/mydatafiles/myfile_201510212245.txt(real=/sourcedata/mydatafiles/myfile_201510212245.txt) with global blacklisted paths
10-23-2015 12:36:49.101 INFO  AdminManager - feedName=oneshotinput, atomUrl=services
10-23-2015 12:36:49.101 INFO  UserManager - Unwound user context: admin -&amp;gt; NULL
10-23-2015 12:36:49.101 DEBUG InThreadActor - this=0x7f472c417150 waitForActorToComplete start actor=0x7f4723bfcdf0
10-23-2015 12:36:49.103 DEBUG InThreadActor - this=0x7f472c417150 waitForActorToComplete end actor=0x7f4723bfcdf0
10-23-2015 12:36:49.104 DEBUG ArchiveContext - /sourcedata/mydatafiles/myfile_201510212245.txt is NOT an archive file.
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/sourcedata/mydatafiles/myfile_201510212245.txt
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Pattern 'source::....(0t|a|ali|asa|au|bmp|cg|cgi|class|d|dat|deb|del|dot|dvi|dylib|elc|eps|exe|ftn|gif|hlp|hqx|hs|icns|ico|inc|iso|jame|jin|jpeg|jpg|kml|la|lhs|lib|lo|lock|mcp|mid|mp3|mpg|msf|nib|o|obj|odt|ogg|ook|opt|os|pal|pbm|pdf|pem|pgm|plo|png|po|pod|pp|ppd|ppm|ppt|prc|ps|psd|psym|pyc|pyd|rast|rb|rde|rdf|rdr|rgb|ro|rpm|rsrc|so|ss|stg|strings|tdt|tif|tiff|tk|uue|vhd|xbm|xlb|xls|xlw)' matches with lowest priority
10-23-2015 12:36:49.104 DEBUG OneShotWriter - Got new entry in the archive: /sourcedata/mydatafiles/myfile_201510212245.txt
10-23-2015 12:36:49.104 DEBUG OneShotWriter - Will call classifier with given_type="mysource".
10-23-2015 12:36:49.104 DEBUG FileClassifierManager - Finding type for file: /sourcedata/mydatafiles/myfile_201510212245.txt
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/sourcedata/mydatafiles/myfile_201510212245.txt
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Pattern 'source::....(0t|a|ali|asa|au|bmp|cg|cgi|class|d|dat|deb|del|dot|dvi|dylib|elc|eps|exe|ftn|gif|hlp|hqx|hs|icns|ico|inc|iso|jame|jin|jpeg|jpg|kml|la|lhs|lib|lo|lock|mcp|mid|mp3|mpg|msf|nib|o|obj|odt|ogg|ook|opt|os|pal|pbm|pdf|pem|pgm|plo|png|po|pod|pp|ppd|ppm|ppt|prc|ps|psd|psym|pyc|pyd|rast|rb|rde|rdf|rdr|rgb|ro|rpm|rsrc|so|ss|stg|strings|tdt|tif|tiff|tk|uue|vhd|xbm|xlb|xls|xlw)' matches with lowest priority
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/sourcedata/mydatafiles/myfile_201510212245.txt|mysource
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Pattern 'source::....(0t|a|ali|asa|au|bmp|cg|cgi|class|d|dat|deb|del|dot|dvi|dylib|elc|eps|exe|ftn|gif|hlp|hqx|hs|icns|ico|inc|iso|jame|jin|jpeg|jpg|kml|la|lhs|lib|lo|lock|mcp|mid|mp3|mpg|msf|nib|o|obj|odt|ogg|ook|opt|os|pal|pbm|pdf|pem|pgm|plo|png|po|pod|pp|ppd|ppm|ppt|prc|ps|psd|psym|pyc|pyd|rast|rb|rde|rdf|rdr|rgb|ro|rpm|rsrc|so|ss|stg|strings|tdt|tif|tiff|tk|uue|vhd|xbm|xlb|xls|xlw)' matches with lowest priority
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Pattern 'mysource' matches with priority 100
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Pattern 'mysource' matches with priority 100
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/sourcedata/mydatafiles/myfile_201510212245.txt|host::server|mysource|
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Pattern 'source::....(0t|a|ali|asa|au|bmp|cg|cgi|class|d|dat|deb|del|dot|dvi|dylib|elc|eps|exe|ftn|gif|hlp|hqx|hs|icns|ico|inc|iso|jame|jin|jpeg|jpg|kml|la|lhs|lib|lo|lock|mcp|mid|mp3|mpg|msf|nib|o|obj|odt|ogg|ook|opt|os|pal|pbm|pdf|pem|pgm|plo|png|po|pod|pp|ppd|ppm|ppt|prc|ps|psd|psym|pyc|pyd|rast|rb|rde|rdf|rdr|rgb|ro|rpm|rsrc|so|ss|stg|strings|tdt|tif|tiff|tk|uue|vhd|xbm|xlb|xls|xlw)' matches with lowest priority
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Pattern 'mysource' matches with priority 100
10-23-2015 12:36:49.104 DEBUG OneShotWriter - Setting sourcetype="sourcetype::mysource" 
10-23-2015 12:36:49.104 DEBUG OneShotWriter - Setting channelKey="2" 
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/sourcedata/mydatafiles/myfile_201510212245.txt|host::server|mysource|2
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Pattern 'source::....(0t|a|ali|asa|au|bmp|cg|cgi|class|d|dat|deb|del|dot|dvi|dylib|elc|eps|exe|ftn|gif|hlp|hqx|hs|icns|ico|inc|iso|jame|jin|jpeg|jpg|kml|la|lhs|lib|lo|lock|mcp|mid|mp3|mpg|msf|nib|o|obj|odt|ogg|ook|opt|os|pal|pbm|pdf|pem|pgm|plo|png|po|pod|pp|ppd|ppm|ppt|prc|ps|psd|psym|pyc|pyd|rast|rb|rde|rdf|rdr|rgb|ro|rpm|rsrc|so|ss|stg|strings|tdt|tif|tiff|tk|uue|vhd|xbm|xlb|xls|xlw)' matches with lowest priority
10-23-2015 12:36:49.104 DEBUG PropertiesMapConfig - Pattern 'mysource' matches with priority 100
10-23-2015 12:36:49.104 DEBUG StructuredDataHeaderExtractor - Read configuration: configured=1 mode=6 HEADER_FIELD_LINE_NUMBER=0 HEADER_FIELD_DELIMITER='|' HEADER_FIELD_QUOTE='"' FIELD_DELIMITER='|' FIELD_QUOTE='"'.
10-23-2015 12:36:49.104 DEBUG OneShotWriter - Structured data configurations loaded
10-23-2015 12:36:49.104 INFO  UTF8Processor - Converting using CHARSET="UTF-8" for conf "source::/sourcedata/mydatafiles/myfile_201510212245.txt|host::server|mysource|2"
10-23-2015 12:36:49.104 INFO  LineBreakingProcessor - Using truncation length 10000 for conf "source::/sourcedata/mydatafiles/myfile_201510212245.txt|host::server|mysource|2"
10-23-2015 12:36:49.104 INFO  LineBreakingProcessor - Using lookbehind 100 for conf "source::/sourcedata/mydatafiles/myfile_201510212245.txt|host::server|mysource|2"
10-23-2015 12:36:49.104 DEBUG StructuredDataHeaderExtractor - Read configuration: configured=1 mode=6 HEADER_FIELD_LINE_NUMBER=0 HEADER_FIELD_DELIMITER='|' HEADER_FIELD_QUOTE='"' FIELD_DELIMITER='|' FIELD_QUOTE='"'.
10-23-2015 12:36:49.105 INFO  AggregatorMiningProcessor - Setting up line merging apparatus for: source::/sourcedata/mydatafiles/myfile_201510212245.txt|host::server|mysource|2
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes - put _mydate regex=source::.*?_(\d{4})(\d{2})(\d{2})
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * year
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * month
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * day
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes - put _mytime regex=source::.*?_\d{8}(\d{2})(\d{2})
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * hour
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * minute
10-23-2015 12:36:49.105 INFO  DateParser - Set timezone to: UTC
10-23-2015 12:36:49.105 DEBUG AggregatorMiningProcessor - Failed to parse timestamp. Defaulting to time specified by data input. - data_source="/sourcedata/mydatafiles/myfile_201510212245.txt", data_host="server", data_sourcetype="mysource"
10-23-2015 12:36:49.105 DEBUG AggregatorMiningProcessor - Failed to parse timestamp. Defaulting to time specified by data input. - data_source="/sourcedata/mydatafiles/myfile_201510212245.txt", data_host="server", data_sourcetype="mysource"
10-23-2015 12:36:49.105 DEBUG AggregatorMiningProcessor - Failed to parse timestamp. Defaulting to time specified by data input. - data_source="/sourcedata/mydatafiles/myfile_201510212245.txt", data_host="server", data_sourcetype="mysource"
10-23-2015 12:36:49.105 DEBUG AggregatorMiningProcessor - Failed to parse timestamp. Defaulting to time specified by data input. - data_source="/sourcedata/mydatafiles/myfile_201510212245.txt", data_host="server", data_sourcetype="mysource"
10-23-2015 12:36:49.105 DEBUG AggregatorMiningProcessor - Failed to parse timestamp. Defaulting to time specified by data input. - data_source="/sourcedata/mydatafiles/myfile_201510212245.txt", data_host="server", data_sourcetype="mysource"
10-23-2015 12:36:49.105 DEBUG AggregatorMiningProcessor - Failed to parse timestamp. Defaulting to time specified by data input. - data_source="/sourcedata/mydatafiles/myfile_201510212245.txt", data_host="server", data_sourcetype="mysource"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To me - the following indicate that the config was successfully loaded from datetime.xml&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes - put _mydate regex=source::.*?_(\d{4})(\d{2})(\d{2})
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * year
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * month
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * day
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes - put _mytime regex=source::.*?_\d{8}(\d{2})(\d{2})
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * hour
10-23-2015 12:36:49.105 DEBUG LoadDateParserRegexes -     * minute
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The regex listed does match &amp;amp; return the fields for the following source:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source::/sourcedata/mydatafiles/myfile_201510212245.txt|host::server|mysource|2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So im really at a bit of a loss at this point &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 01:50:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204142#M59316</guid>
      <dc:creator>ahartge</dc:creator>
      <dc:date>2015-10-23T01:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204143#M59317</link>
      <description>&lt;P&gt;One thought also sprang to mind - are we all trying to perform something out of the processing order ?&lt;/P&gt;

&lt;P&gt;When I re-read &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Overviewofeventprocessing"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Overviewofeventprocessing&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;When Splunk Enterprise indexes events, it:&lt;/P&gt;

&lt;P&gt;Configures character set encoding.&lt;BR /&gt;
Configures linebreaking for multi-line events.&lt;BR /&gt;
&lt;STRONG&gt;Identifies event timestamps (and applies timestamps to events if they do not exist).&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;Extracts a set of useful standard fields such as host, source, and sourcetype.&lt;/STRONG&gt;&lt;BR /&gt;
Segments events.&lt;BR /&gt;
Dynamically assigns metadata to events, if specified.&lt;BR /&gt;
Anonymizes data, if specified.&lt;/P&gt;

&lt;P&gt;To me - this indicates that splunk will apply timestamps BEFORE extracting the source field ........ so if im trying to get the timestamp FROM source before it has been extracted ...... am I trying to tear a hole in the space-time continuum ?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 02:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204143#M59317</guid>
      <dc:creator>ahartge</dc:creator>
      <dc:date>2015-10-23T02:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204144#M59318</link>
      <description>&lt;P&gt;an ugly search time hack makes the results appear correct when returning searches, but as the indexed timestamp is incorrect, I cant actually search on the specific day, just have to search for All Time.&lt;/P&gt;

&lt;P&gt;Adding the following to props.conf overwrites _time at search time - as I said - U.G.L.Y .....&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-timestamp = \w_(?&amp;lt;srctimestamp&amp;gt;\d+) in source
EVAL-_time = strptime(srctimestamp, "%Y%m%d%H%M")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Oct 2015 04:11:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204144#M59318</guid>
      <dc:creator>ahartge</dc:creator>
      <dc:date>2015-10-23T04:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204145#M59319</link>
      <description>&lt;P&gt;First of all, if you are the author of the app, you should use &lt;CODE&gt;default&lt;/CODE&gt;, not &lt;CODE&gt;local&lt;/CODE&gt;.  Second, you do not need the &lt;CODE&gt;TIME_FORMAT&lt;/CODE&gt; line.  Third: did you put the &lt;CODE&gt;datetime.xml&lt;/CODE&gt; file in the correct place (does it match your &lt;CODE&gt;DATETIME_CONFIG&lt;/CODE&gt; line)?  Lastly, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;define name="_mydatetime" extract="year, month, day, hour, minute"&amp;gt;
   &amp;lt;text&amp;gt;&amp;lt;![CDATA[source::.*?_(\d{4})(\d{2})(\d{2})(\d{2})(\d{2}).txt]]&amp;gt;&amp;lt;/text&amp;gt;
&amp;lt;/define&amp;gt;
&amp;lt;timePatterns&amp;gt;
   &amp;lt;use name="_mydatetime"/&amp;gt;
&amp;lt;/timePatterns&amp;gt;
&amp;lt;datePatterns&amp;gt;
   &amp;lt;use name="_mydatetime"/&amp;gt;
&amp;lt;/datePatterns&amp;gt;
&amp;lt;/datetime&amp;gt; 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You must deploy this to your Indexers (or Heavy Forwarder) and restart all splunk instances running there.  This will only effect &lt;EM&gt;new&lt;/EM&gt; data that comes in after the restarts; already-indexed data will remain broken.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 15:09:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204145#M59319</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-23T15:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204146#M59320</link>
      <description>&lt;P&gt;Thanks again for your help woodcock - but this still failed&lt;/P&gt;

&lt;P&gt;Here are all the details if you could reproduce the issue.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;The Data&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;root@testbox:/opt/data# cat myfile_201510210345.txt
IP|10.0.0.1/32|proxy|65|||2015/10/19|proxy server 
root@testbox:/opt/data# 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf and datetime.xml&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;root@testbox:/opt/splunk/etc/apps/myapp/local# cat props.conf 
[mysource]
DATETIME_CONFIG = /etc/apps/myapp/local/datetime.xml
FIELD_DELIMITER = |
FIELD_NAMES = F1,F2,F3,F4,F5,F6,F7,F8
TZ = UTC
NO_BINARY_CHECK = true
SHOULD_LINEMERGE = false
root@testbox:/opt/splunk/etc/apps/myapp/local# 

root@testbox:/opt/splunk/etc/apps/myapp/local# cat datetime.xml
&amp;lt;!--   Version 4.0 --&amp;gt;

&amp;lt;!-- datetime.xml --&amp;gt;
&amp;lt;!-- This file contains the general formulas for parsing date/time formats. --&amp;gt;

&amp;lt;datetime&amp;gt;

&amp;lt;define name="_mydatetime" extract="year, month, day, hour, minute"&amp;gt;
        &amp;lt;text&amp;gt;&amp;lt;![CDATA[source::.*?_(\d{4})(\d{2})(\d{2})(\d{2})(\d{2}).txt]]&amp;gt;&amp;lt;/text&amp;gt;
&amp;lt;/define&amp;gt;


&amp;lt;timePatterns&amp;gt;
      &amp;lt;use name="_mydatetime"/&amp;gt;
&amp;lt;/timePatterns&amp;gt;
&amp;lt;datePatterns&amp;gt;
      &amp;lt;use name="_mydatetime"/&amp;gt;
&amp;lt;/datePatterns&amp;gt;

&amp;lt;/datetime&amp;gt;
root@testbox:/opt/splunk/etc/apps/myapp/local#
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;btool output showing full config&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;root@ashlubuntu:/opt/splunk/etc/apps/myapp/local# /opt/splunk/bin/splunk btool props list mysource
[mysource]
ANNOTATE_PUNCT = True
AUTO_KV_JSON = true
BREAK_ONLY_BEFORE = 
BREAK_ONLY_BEFORE_DATE = True
CHARSET = UTF-8
DATETIME_CONFIG = /etc/apps/myapp/local/datetime.xml
FIELD_DELIMITER = |
FIELD_NAMES = F1,F2,F3,F4,F5,F6,F7,F8
HEADER_MODE = 
LEARN_SOURCETYPE = true
LINE_BREAKER_LOOKBEHIND = 100
MAX_DAYS_AGO = 2000
MAX_DAYS_HENCE = 2
MAX_DIFF_SECS_AGO = 3600
MAX_DIFF_SECS_HENCE = 604800
MAX_EVENTS = 256
MAX_TIMESTAMP_LOOKAHEAD = 128
MUST_BREAK_AFTER = 
MUST_NOT_BREAK_AFTER = 
MUST_NOT_BREAK_BEFORE = 
NO_BINARY_CHECK = true
SEGMENTATION = indexing
SEGMENTATION-all = full
SEGMENTATION-inner = inner
SEGMENTATION-outer = outer
SEGMENTATION-raw = none
SEGMENTATION-standard = standard
SHOULD_LINEMERGE = false
TRANSFORMS = 
TRUNCATE = 10000
TZ = UTC
detect_trailing_nulls = false
maxDist = 100
priority = 
sourcetype = 
root@ashlubuntu:/opt/splunk/etc/apps/myapp/local# 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;oneshot import&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;root@ashlubuntu:/opt/data# /opt/splunk/bin/splunk add oneshot myfile_201510210345.txt -sourcetype "mysource" -index "testindex" -host "myhost"
Your session is invalid.  Please login.
Splunk username: admin
Password: 
Oneshot '/opt/data/myfile_201510210345.txt' added
root@ashlubuntu:/opt/data# 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;splunkd.log DEBUG output - showing it recognises the config, but fails to parse the timestamp&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10-28-2015 22:56:39.543 DEBUG REST_Calls - app=search POST data/inputs/oneshot/ id=/opt/data/myfile_201510210345.txt: host -&amp;gt; [myhost], index -&amp;gt; [testindex], sourcetype -&amp;gt; [mysource]
10-28-2015 22:56:39.543 DEBUG AdminManager - Validating argument values...
10-28-2015 22:56:39.543 DEBUG AdminManager - Validating rule='validate(len(name) &amp;lt; 1024, 'Parameter "name" must be less than 1024 characters.')' for arg='name'.
10-28-2015 22:56:39.589 DEBUG FilesystemFilter - Testing path=/opt/data/myfile_201510210345.txt(real=/opt/data/myfile_201510210345.txt) with global blacklisted paths
10-28-2015 22:56:39.590 INFO  AdminManager - feedName=oneshotinput, atomUrl=services
10-28-2015 22:56:39.590 INFO  UserManager - Unwound user context: admin -&amp;gt; NULL
10-28-2015 22:56:39.590 DEBUG InThreadActor - this=0x7f8454016b50 waitForActorToComplete start actor=0x7f844a3fcdf0
10-28-2015 22:56:39.592 DEBUG InThreadActor - this=0x7f8454016b50 waitForActorToComplete end actor=0x7f844a3fcdf0
10-28-2015 22:56:39.593 DEBUG ArchiveContext - /opt/data/myfile_201510210345.txt is NOT an archive file.
10-28-2015 22:56:39.593 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/opt/data/myfile_201510210345.txt
10-28-2015 22:56:39.593 DEBUG OneShotWriter - Got new entry in the archive: /opt/data/myfile_201510210345.txt
10-28-2015 22:56:39.593 DEBUG OneShotWriter - Will call classifier with given_type="mysource".
10-28-2015 22:56:39.593 DEBUG FileClassifierManager - Finding type for file: /opt/data/myfile_201510210345.txt
10-28-2015 22:56:39.593 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/opt/data/myfile_201510210345.txt
10-28-2015 22:56:39.593 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/opt/data/myfile_201510210345.txt|mysource
10-28-2015 22:56:39.593 DEBUG PropertiesMapConfig - Pattern 'mysource' matches with priority 100
10-28-2015 22:56:39.593 DEBUG PropertiesMapConfig - Pattern 'mysource' matches with priority 100
10-28-2015 22:56:39.593 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/opt/data/myfile_201510210345.txt|host::myhost|mysource|
10-28-2015 22:56:39.594 DEBUG PropertiesMapConfig - Pattern 'mysource' matches with priority 100
10-28-2015 22:56:39.594 DEBUG OneShotWriter - Setting sourcetype="sourcetype::mysource" 
10-28-2015 22:56:39.594 DEBUG OneShotWriter - Setting channelKey="2" 
10-28-2015 22:56:39.594 DEBUG PropertiesMapConfig - Performing pattern matching for: source::/opt/data/myfile_201510210345.txt|host::myhost|mysource|2
10-28-2015 22:56:39.594 DEBUG PropertiesMapConfig - Pattern 'mysource' matches with priority 100
10-28-2015 22:56:39.594 DEBUG StructuredDataHeaderExtractor - Read configuration: configured=1 mode=6 HEADER_FIELD_LINE_NUMBER=0 HEADER_FIELD_DELIMITER='|' HEADER_FIELD_QUOTE='"' FIELD_DELIMITER='|' FIELD_QUOTE='"'.
10-28-2015 22:56:39.594 DEBUG OneShotWriter - Structured data configurations loaded
10-28-2015 22:56:39.594 INFO  UTF8Processor - Converting using CHARSET="UTF-8" for conf "source::/opt/data/myfile_201510210345.txt|host::myhost|mysource|2"
10-28-2015 22:56:39.594 INFO  LineBreakingProcessor - Using truncation length 10000 for conf "source::/opt/data/myfile_201510210345.txt|host::myhost|mysource|2"
10-28-2015 22:56:39.594 INFO  LineBreakingProcessor - Using lookbehind 100 for conf "source::/opt/data/myfile_201510210345.txt|host::myhost|mysource|2"
10-28-2015 22:56:39.594 DEBUG StructuredDataHeaderExtractor - Read configuration: configured=1 mode=6 HEADER_FIELD_LINE_NUMBER=0 HEADER_FIELD_DELIMITER='|' HEADER_FIELD_QUOTE='"' FIELD_DELIMITER='|' FIELD_QUOTE='"'.
10-28-2015 22:56:39.594 INFO  AggregatorMiningProcessor - Setting up line merging apparatus for: source::/opt/data/myfile_201510210345.txt|host::myhost|mysource|2
10-28-2015 22:56:39.595 DEBUG LoadDateParserRegexes - put _mydatetime regex=source::.*?_(\d{4})(\d{2})(\d{2})(\d{2})(\d{2}).txt
10-28-2015 22:56:39.595 DEBUG LoadDateParserRegexes -     * year
10-28-2015 22:56:39.595 DEBUG LoadDateParserRegexes -     * month
10-28-2015 22:56:39.595 DEBUG LoadDateParserRegexes -     * day
10-28-2015 22:56:39.595 DEBUG LoadDateParserRegexes -     * hour
10-28-2015 22:56:39.595 DEBUG LoadDateParserRegexes -     * minute
10-28-2015 22:56:39.595 INFO  DateParser - Set timezone to: UTC
10-28-2015 22:56:39.595 DEBUG AggregatorMiningProcessor - Failed to parse timestamp. Defaulting to time specified by data input. - data_source="/opt/data/myfile_201510210345.txt", data_host="myhost", data_sourcetype="mysource"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is the data in splunk - you can see the same time for _time and _indextime. Splunk didnt even use the file time, it reverted to the indextime.&lt;/P&gt;

&lt;P&gt;Im wondering if this needs to be a support case, I cannot seem to get the timestamp from a filename.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://www.dropbox.com/s/f40xx78v5zctpon/mysource.PNG?dl=0" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;hxxps://&lt;A href="http://www.dropbox.com/s/f40xx78v5zctpon/mysource.PNG?dl=0"&gt;www.dropbox.com/s/f40xx78v5zctpon/mysource.PNG?dl=0&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 23:12:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204146#M59320</guid>
      <dc:creator>ahartge</dc:creator>
      <dc:date>2015-10-28T23:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204147#M59321</link>
      <description>&lt;P&gt;I would &lt;EM&gt;definitely&lt;/EM&gt; open a support case on this.  The logs clearly indicate that it is using your &lt;CODE&gt;datetime.xml&lt;/CODE&gt; file.  We know the RegEx works but still the parser is failing.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2015 16:02:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204147#M59321</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-29T16:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204148#M59322</link>
      <description>&lt;P&gt;So I logged a support case [283416] for this problem and unfortunately for me &amp;amp; everyone following along here - extracting a full timestamp from a filename is not currently supported in Splunk.&lt;/P&gt;

&lt;P&gt;You can capture the date from the filename, but not the time - so in essence each line in the file needs to have a time record.&lt;/P&gt;

&lt;P&gt;There apparently is several other customers that have requested this feature and I have been added to the bottom of that enhancement request.&lt;/P&gt;

&lt;P&gt;I was hoping that I wouldnt have to modify the data before indexing it, but the way it looks like im going to have to get around it is with some pre-processing of the log.&lt;/P&gt;

&lt;P&gt;This will append the timestamp of the filename to the front of each line of the file, with a pipe "|" seperator - at least this will index with automatic timestamp extraction, without having to define any time format strings.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;find . -name '*201510210345.txt' -type f -print | xargs sed -i 's/^/201510210345\|/'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Nov 2015 06:24:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204148#M59322</guid>
      <dc:creator>ahartge</dc:creator>
      <dc:date>2015-11-05T06:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204149#M59323</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
i have a question to this answer. Where can find the keywords of the extract attribute and how define the timePatterns and datePatterns for a unix timestamp?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Sven&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 07:53:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204149#M59323</guid>
      <dc:creator>SK8</dc:creator>
      <dc:date>2017-03-02T07:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204150#M59324</link>
      <description>&lt;P&gt;Search for &lt;CODE&gt;datetime.xml&lt;/CODE&gt;.  It is not necessary but everybody uses that same filename.  Learn from working examples posted on the internet.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 15:45:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204150#M59324</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-02T15:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204151#M59325</link>
      <description>&lt;P&gt;I noticed in the last attempt that the names timepatterns and datepatterns are swapped.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 20:40:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204151#M59325</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-12-15T20:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204152#M59326</link>
      <description>&lt;P&gt;@woodcock - Names in the XML for timePatterns and datePatterns are swapped.  Any chance that is related to the issue?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 20:42:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204152#M59326</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-12-15T20:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204153#M59327</link>
      <description>&lt;P&gt;They are not swapped, they are shared.  But the problem is that H/M/S from file is not supported (see the accepted answer).  Bummer.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Dec 2017 23:04:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204153#M59327</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-16T23:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204154#M59328</link>
      <description>&lt;P&gt;This is possible in Splunk Enterprise 7.2, making use of the new ingest-time eval. Full documentation is at &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Data/IngestEval" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Data/IngestEval&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Example&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;File Name: Log_I15_13092018183001.txt&lt;BR /&gt;
File Name Format: Log_I15_%d%m%Y%H%M%S.txt&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mysourcetype]
TRANSFORMS=timestampeval
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[timestampeval]
INGEST_EVAL = _time=strptime(replace(source,".*(?=/)/",""),"Log_I15_%d%m%Y%H%M%S.txt")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This takes the "source" metadata value (which is the path and file name), removes the path, then extracts the date and time from the filename.&lt;/P&gt;

&lt;P&gt;All events in the file will have the same _time when imported.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:43:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204154#M59328</guid>
      <dc:creator>mthomas_splunk</dc:creator>
      <dc:date>2020-09-29T22:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204155#M59329</link>
      <description>&lt;P&gt;I downvoted this post because no longer accurate with 7.2 enhancement&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 23:28:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204155#M59329</guid>
      <dc:creator>akira_splunk</dc:creator>
      <dc:date>2019-04-01T23:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204156#M59330</link>
      <description>&lt;P&gt;I downvoted this post because although correct at the time, this answer is no longer accurate&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 09:18:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/204156#M59330</guid>
      <dc:creator>mthomas_splunk</dc:creator>
      <dc:date>2019-04-02T09:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/599602#M208698</link>
      <description>&lt;P&gt;One thing I would like to add to this is that if there is a timestamp in the raw events (without a date). You can also include it in the INGEST_EVAL.&lt;/P&gt;&lt;P&gt;In addition you can also set the character position of the file name to using x-coordinates to define the date (or text) to extract.&lt;/P&gt;&lt;P&gt;Ex.&amp;nbsp;&lt;/P&gt;&lt;P&gt;File: /path/to/file/MY_FILE-&lt;STRONG&gt;&lt;FONT color="#339966"&gt;25-02.22&lt;/FONT&gt;&lt;/STRONG&gt;.log&amp;nbsp;&lt;/P&gt;&lt;P&gt;Raw Event:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;08:36:22:27910&lt;/FONT&gt; &lt;/STRONG&gt;| {event log details|[that are not]:// important-or-relevant (to the overall) solution..\\}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;INGEST_EVAL = _time=strptime(substr(&lt;STRONG&gt;&lt;FONT color="#339966"&gt;source,-12,8&lt;/FONT&gt;&lt;/STRONG&gt;).substr(&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;_&lt;/FONT&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;raw,0,15&lt;/FONT&gt;&lt;/STRONG&gt;), "%d-%m.%y%H:%M:%S:%Q")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 16:38:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/599602#M208698</guid>
      <dc:creator>tyloney</dc:creator>
      <dc:date>2022-05-27T16:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the timestamp from a filename at index-time to use as _time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/609205#M211833</link>
      <description>&lt;P&gt;This suggestion is what worked for my use case also. Thanks for providing an alternative solution - I tried the datetime.xml file stuff and got nowhere when trying to set the date from the file name.&lt;/P&gt;&lt;P&gt;For anyone else, you can test the eval with SPL like so for my case:&lt;/P&gt;&lt;PRE&gt;| makeresults
| eval source="/my_file_path/downloaded_files/2022-08-22_daily_log.csv"
| eval _time=strptime(replace(source,".*(?=/)/",""),"%Y-%m-%d_daily_log.csv")&lt;/PRE&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 11 Aug 2022 18:43:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-timestamp-from-a-filename-at-index-time-to/m-p/609205#M211833</guid>
      <dc:creator>m_pham</dc:creator>
      <dc:date>2022-08-11T18:43:04Z</dc:date>
    </item>
  </channel>
</rss>

