<?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: Pull Date from Filename in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Pull-Date-from-Filename/m-p/226347#M176229</link>
    <description>&lt;P&gt;Although your props.conf has SHOULD_LINEMERGE as false, I am not sure why the screenshot you provided has mutiple events merged together. If every event in your log does not have end line character then you should also consider using BREAK_ONLY_BEFORE or BREAK_ONLY_AFTER parameters for props.conf.&lt;/P&gt;

&lt;P&gt;Nevertheless, Splunk has several inbuilt algorithms with precedence in order to identify timestamp of each event. If every algorithm fails, it resorts to File Modified time. In your screenshot I can see that even filename is having same date as that logged inside the file. So if you edit Timestamp identification of props.conf, you might be able to tell Splunk to always get date from the file modified date and time from the event timestamp. In your case you may achieve this by setting &lt;STRONG&gt;MAX_TIMESTAMP_LOOKAHEAD=8&lt;/STRONG&gt; which overlooks the event Date: 16-06-2016 00:00:33 to extract datetime of the event.&lt;/P&gt;

&lt;P&gt;[custom_type]&lt;BR /&gt;
&lt;STRONG&gt;SHOULD_LINEMERGE=false&lt;/STRONG&gt;&lt;BR /&gt;
NO_BINARY_CHECK=true&lt;BR /&gt;
CHARSET=AUTO&lt;BR /&gt;
&lt;STRONG&gt;MAX_TIMESTAMP_LOOKAHEAD=8&lt;/STRONG&gt;&lt;BR /&gt;
disabled=false&lt;BR /&gt;
invalid_cause=binary&lt;BR /&gt;
is_valid=false&lt;/P&gt;

&lt;P&gt;PS: If possible you should consider as to how to get the logs written with Date-Time stamp for each event rather than just time, as Time of event is the most crucial information for proper indexing of data. &lt;/P&gt;

&lt;P&gt;Above method might fail when date rolls over from one to other around midnight.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 11:48:21 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2020-09-29T11:48:21Z</dc:date>
    <item>
      <title>Pull Date from Filename</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pull-Date-from-Filename/m-p/226345#M176227</link>
      <description>&lt;P&gt;So I have some logs that are in the following format: &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2135i40E2D193D81A45A1/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
Filename: 16061601rw.dat&lt;/P&gt;

&lt;P&gt;Each line has a time stamp, but it doesn't include the date.  I've checked a ton of answers about getting date from the filename but i cant get it to work properly.  When it is being ingested into splunk it looks like this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2136i2C0474B54EF00E76/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;It is probably worth mentioning that where it starts stamping them as 15/06/2016, it has defaulted back to the last logs date.&lt;/P&gt;

&lt;P&gt;Here is my attempted edit of the datetime.xml:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;text&amp;gt;&amp;lt;![CDATA[source::.*?((\d{2})(\d{2})(\d{2}))*.dat]]&amp;gt;&amp;lt;/text&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and I have a custom data type in props.conf that I am trying to use to get it to correctly date the entries:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[custom_type]
DATETIME_CONFIG = /Applications/Splunk/etc/datetime.xml
SHOULD_LINEMERGE = FALSE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can anyone help with this?  I think it is most likely an issue with the regex but I'm not sure&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2016 07:10:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pull-Date-from-Filename/m-p/226345#M176227</guid>
      <dc:creator>adrianduff</dc:creator>
      <dc:date>2016-11-11T07:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Pull Date from Filename</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pull-Date-from-Filename/m-p/226346#M176228</link>
      <description>&lt;P&gt;FIrst, I would never do this by editing datetime.xml if there were any other way. But that is not your current problem.&lt;/P&gt;

&lt;P&gt;Here is the problem: your props.conf is not being used. &lt;BR /&gt;
I can tell because props.conf specifies that the input is one line per event, but that is not at all what Splunk is doing.&lt;BR /&gt;
Where is the inputs.conf that collects this data? What kind of forwarder are you using? Where is this props.conf located? Does the sourcetype that you assigned in inputs.conf match the sourcetype you specified in props.conf?&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2016 14:33:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pull-Date-from-Filename/m-p/226346#M176228</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2016-11-13T14:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Pull Date from Filename</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pull-Date-from-Filename/m-p/226347#M176229</link>
      <description>&lt;P&gt;Although your props.conf has SHOULD_LINEMERGE as false, I am not sure why the screenshot you provided has mutiple events merged together. If every event in your log does not have end line character then you should also consider using BREAK_ONLY_BEFORE or BREAK_ONLY_AFTER parameters for props.conf.&lt;/P&gt;

&lt;P&gt;Nevertheless, Splunk has several inbuilt algorithms with precedence in order to identify timestamp of each event. If every algorithm fails, it resorts to File Modified time. In your screenshot I can see that even filename is having same date as that logged inside the file. So if you edit Timestamp identification of props.conf, you might be able to tell Splunk to always get date from the file modified date and time from the event timestamp. In your case you may achieve this by setting &lt;STRONG&gt;MAX_TIMESTAMP_LOOKAHEAD=8&lt;/STRONG&gt; which overlooks the event Date: 16-06-2016 00:00:33 to extract datetime of the event.&lt;/P&gt;

&lt;P&gt;[custom_type]&lt;BR /&gt;
&lt;STRONG&gt;SHOULD_LINEMERGE=false&lt;/STRONG&gt;&lt;BR /&gt;
NO_BINARY_CHECK=true&lt;BR /&gt;
CHARSET=AUTO&lt;BR /&gt;
&lt;STRONG&gt;MAX_TIMESTAMP_LOOKAHEAD=8&lt;/STRONG&gt;&lt;BR /&gt;
disabled=false&lt;BR /&gt;
invalid_cause=binary&lt;BR /&gt;
is_valid=false&lt;/P&gt;

&lt;P&gt;PS: If possible you should consider as to how to get the logs written with Date-Time stamp for each event rather than just time, as Time of event is the most crucial information for proper indexing of data. &lt;/P&gt;

&lt;P&gt;Above method might fail when date rolls over from one to other around midnight.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:48:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pull-Date-from-Filename/m-p/226347#M176229</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T11:48:21Z</dc:date>
    </item>
  </channel>
</rss>

