<?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: Splunk seems to be ignoring TIME_FORMAT setting in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81881#M16906</link>
    <description>&lt;P&gt;What is the data looks like when you have problem. &lt;/P&gt;

&lt;P&gt;This props.conf works with this data.&lt;/P&gt;

&lt;P&gt;1/11/2012 3:23 PM,0,1,1 linea&lt;/P&gt;

&lt;P&gt;2/11/2012 3:23 PM,0,1,1 lineb&lt;/P&gt;

&lt;P&gt;14/11/2012 3:23 PM,0,1,1 linec&lt;/P&gt;

&lt;P&gt;5/12/2012 3:23 PM,0,1,1 lined&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;NO_BINARY_CHECK=1&lt;BR /&gt;
SHOULD_LINEMERGE=false&lt;BR /&gt;
TIME_FORMAT=%d/%m/%Y %I:%M %p&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 13:04:43 GMT</pubDate>
    <dc:creator>daniel_splunk</dc:creator>
    <dc:date>2020-09-28T13:04:43Z</dc:date>
    <item>
      <title>Splunk seems to be ignoring TIME_FORMAT setting</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81878#M16903</link>
      <description>&lt;P&gt;I have an event in CSV format like this:&lt;/P&gt;

&lt;P&gt;1/11/2012 3:23 PM,0,1,1&lt;/P&gt;

&lt;P&gt;These dates are in the date format common to Australia (DD/MM/YYYY). For all days prior to the 13th of each month, &lt;EM&gt;some&lt;/EM&gt; (but not all) events are being parsed as if they were using the date format prevalent in the US (MM/DD/YYYY); there is inconsistency even within a single file.&lt;/P&gt;

&lt;P&gt;The correct &lt;A href="http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html"&gt;strptime&lt;/A&gt; format for this date string is:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;%d/%m/%Y %I:%M %p&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;As demonstrated in the following program:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#define _XOPEN_SOURCE
#include &amp;lt;time.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
int main(void) {
    struct tm thetime;
    char *not_proced = strptime("1/11/2012 3:23 PM", "%d/%m/%Y %I:%M %p", &amp;amp;thetime);
    printf("Month: %d\n", thetime.tm_mon);
    // prints 10, representing November
    printf("Not processed: %s\n", not_proced);
    // prints an empty string
    return 0;
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So my stanza in &lt;CODE&gt;profs.conf&lt;/CODE&gt; looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mysourcetype]
TRANSFORMS-mysourcetype = remove_headers
CHECK_FOR_HEADER = true
SHOULD_LINEMERGE = false
MAX_TIMESTAMP_LOOKAHEAD=20
TIME_PREFIX=^
TIME_FORMAT="%d/%m/%Y %I:%M %p"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tried it with and without each of the three time settings fields, and without the quotes around the format string.&lt;/P&gt;

&lt;P&gt;There are no relevant errors in the &lt;CODE&gt;_internal&lt;/CODE&gt; index about timestamp parsing.&lt;/P&gt;

&lt;P&gt;Why is Splunk guessing the time format when I've hard coded it?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2013 04:25:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81878#M16903</guid>
      <dc:creator>dbryan</dc:creator>
      <dc:date>2013-01-09T04:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk seems to be ignoring TIME_FORMAT setting</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81879#M16904</link>
      <description>&lt;P&gt;I believe that &lt;CODE&gt;%d&lt;/CODE&gt; may not be the correct choice, since it implies that there should be leading zeroes.&lt;BR /&gt;
Try with &lt;CODE&gt;%e&lt;/CODE&gt; instead (no leading zeroes)&lt;/P&gt;

&lt;P&gt;As for the hour, you could try substituting &lt;CODE&gt;%I&lt;/CODE&gt; with &lt;CODE&gt;%l&lt;/CODE&gt; (no leading zeroes)&lt;/P&gt;

&lt;P&gt;See &lt;A href="http://www.strftime.net"&gt;www.strftime.net&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2013 09:17:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81879#M16904</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-01-09T09:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk seems to be ignoring TIME_FORMAT setting</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81880#M16905</link>
      <description>&lt;P&gt;According to &lt;A href="http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html"&gt;http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html&lt;/A&gt;, which is what the Splunk documentation suggests Splunk uses, "leading zeros are permitted but not required" for %d and also %e by implication. I tried it with %e and there was no change.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2013 22:42:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81880#M16905</guid>
      <dc:creator>dbryan</dc:creator>
      <dc:date>2013-01-09T22:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk seems to be ignoring TIME_FORMAT setting</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81881#M16906</link>
      <description>&lt;P&gt;What is the data looks like when you have problem. &lt;/P&gt;

&lt;P&gt;This props.conf works with this data.&lt;/P&gt;

&lt;P&gt;1/11/2012 3:23 PM,0,1,1 linea&lt;/P&gt;

&lt;P&gt;2/11/2012 3:23 PM,0,1,1 lineb&lt;/P&gt;

&lt;P&gt;14/11/2012 3:23 PM,0,1,1 linec&lt;/P&gt;

&lt;P&gt;5/12/2012 3:23 PM,0,1,1 lined&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;NO_BINARY_CHECK=1&lt;BR /&gt;
SHOULD_LINEMERGE=false&lt;BR /&gt;
TIME_FORMAT=%d/%m/%Y %I:%M %p&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:04:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81881#M16906</guid>
      <dc:creator>daniel_splunk</dc:creator>
      <dc:date>2020-09-28T13:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk seems to be ignoring TIME_FORMAT setting</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81882#M16907</link>
      <description>&lt;P&gt;definitely you should &lt;EM&gt;not&lt;/EM&gt; have quotes are around the format string, or else it will require them in the timestamp.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 02:58:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81882#M16907</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2013-01-17T02:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk seems to be ignoring TIME_FORMAT setting</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81883#M16908</link>
      <description>&lt;P&gt;You should not have quotes in the format string. There is something off in the configuration you have provided. Basically if Splunk is unable to match according to what's in &lt;CODE&gt;TIME_FORMAT&lt;/CODE&gt;/&lt;CODE&gt;TIME_PREFIX&lt;/CODE&gt;/etc in props.conf, it will fall through to the internal default rules (which are defined in etc/datetime.xml). &lt;/P&gt;

&lt;P&gt;I would not entirely take the opengroup docs as absolutely definitive, as Splunk has a couple of extensions to the format. But do I think that if you data is in fact in that single-line CSV format, and the timestamp is the first entry, you should be able to use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE = false
TIME_PREFIX = ^
MAX_TIMESTAMP_LOOKAHEAD = 20
TIME_FORMAT = %d/%m/%Y %I:%M %p
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Another possibility I suppose is that the sourcetype simply isn't getting applied to your data, and it's still using the defaults.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;A quick and dirty hack you can use to try to see what might be the case would be to modify the default fall-through rules in datetime.xml file and switch the order of the "usdate" and "eurodate" formats listed in the "datePatterns" section of the file. You can do this a couple of ways. One way, just copy the file to a new location, make the changes, then add:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DATETIME_CONFIG = /etc/newdatetime.xml
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(path is relative to &lt;CODE&gt;SPLUNK_HOME&lt;/CODE&gt;) to your sourcetype. If that works, then it indicates that the sourcetype is matching, but for some reason the specified &lt;CODE&gt;TIME_FORMAT&lt;/CODE&gt; isn't being applied. The second test would simply be modify the original datetime.xml. If that has no effect, it would indicate that the sourcetype matching is not right for some reason.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 03:15:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-seems-to-be-ignoring-TIME-FORMAT-setting/m-p/81883#M16908</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2013-01-17T03:15:27Z</dc:date>
    </item>
  </channel>
</rss>

