<?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: Why do I keep getting an error extracting the timestamp from formatted text data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114670#M30350</link>
    <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;Thanks for you answer, however it does not seem to be working. &lt;/P&gt;

&lt;P&gt;I have been experimenting with a small subset, altered data. &lt;BR /&gt;
This is my test data I am trying to import: &lt;/P&gt;

&lt;P&gt;ABE 1900    01  05  19  00  0.00    -3.000  102.000 7.0&lt;BR /&gt;
ABE 1900    01  11  09  07  0.00    -5.000  148.000 7.0&lt;BR /&gt;
UTSU    1900    01  18  07  46  0.00    44.500  148.500 6.7&lt;BR /&gt;
ABE 1900    01  20  06  33  0.00    20.000  -105.000    7.3&lt;BR /&gt;
UTSU    1900    01  31  19  22  0.00    48.000  146.000 7.5&lt;/P&gt;

&lt;P&gt;The fields are tab sepparated. &lt;BR /&gt;
There is no timestamp available according to the splunk import interface. &lt;/P&gt;

&lt;P&gt;So I'm trying to import the file, and assign a timestamp to the events, extracted from the sepparated date fields: year, month, day, ...&lt;/P&gt;

&lt;P&gt;I managed to transform the date fields into one field with any desired layout, an example: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[fixEarthquakeDates]
REGEX = (.{3,4})([\t]{1})([\d]{4})([\t]{1})([\d]{2})([\t]{1})([\d]{2})([\t]{1})([\d]{2})([\t]{1})([\d]{2})(.+)
FORMAT = $1$2$3-$5-$7 $9:$11:00.00 $12
DEST_KEY = _raw 
SOURCE_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Formats the data as follows: &lt;/P&gt;

&lt;P&gt;ABE    1900-01-05 19:00:00.00  0.00    -3.000  102.000 7.0&lt;BR /&gt;
 ABE    1900-01-11 09:07:00.00  0.00    -5.000  148.000 7.0&lt;BR /&gt;
 UTSU   1900-01-18 07:46:00.00  0.00    44.500  148.500 6.7&lt;BR /&gt;
 ABE    1900-01-20 06:33:00.00  0.00    20.000  -105.000    7.3&lt;/P&gt;

&lt;P&gt;Any other format can be achieved with the regex transformation. (I tried several alternatives).&lt;/P&gt;

&lt;P&gt;The error I keep getting is: &lt;BR /&gt;
Could not use strptime to parse timestamp from "1900 01 05 19 00 0.00 -3.000 102.000 7.0".&lt;BR /&gt;
Failed to parse timestamp. Defaulting to file modtime.&lt;/P&gt;

&lt;P&gt;Current settings :  &lt;/P&gt;

&lt;P&gt;MAX_TIMESTAMP_LOOKAHEAD=0&lt;BR /&gt;
NO_BINARY_CHECK=true&lt;BR /&gt;
SHOULD_LINEMERGE=false&lt;BR /&gt;
TIME_FORMAT=%Y %m %d %H %M %S.%2N&lt;BR /&gt;
TIME_PREFIX=\t&lt;BR /&gt;
TRANSFORMS-timestamp=fixEarthquakeDates&lt;BR /&gt;
TZ=UTC&lt;BR /&gt;
disabled=false&lt;BR /&gt;
pulldown_type=true&lt;/P&gt;

&lt;P&gt;Have been playing with numerous alternatives for the TIME_FORMAT, to no effect. &lt;/P&gt;

&lt;P&gt;Apparently the transformation happens after the parsing for a timestamp ? &lt;/P&gt;

&lt;P&gt;Can someone confirm this ? Or point me in the right direction ? &lt;/P&gt;

&lt;P&gt;Regards, &lt;BR /&gt;
Ken. &lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:45:19 GMT</pubDate>
    <dc:creator>kenvanderheyden</dc:creator>
    <dc:date>2020-09-28T18:45:19Z</dc:date>
    <item>
      <title>Why do I keep getting an error extracting the timestamp from formatted text data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114667#M30347</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I'm having an issue with timestamp extraction. &lt;BR /&gt;
Trying to extract the timestamp from formatted text, and I can't alter the format of the text. &lt;/P&gt;

&lt;P&gt;Problem is the text is space separated and the generated number of spaces between the date elements is not consistent due to the missing leading 0-s in the month and day parts. &lt;BR /&gt;
Below are a few example lines of text:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ABE 1900 1 5 19 0 0.00 
ABE 1900 1 11 9 7 0.00 
UTSU 1900 1 18 7 46 0.00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tried the following settings to extract the timestamp at import:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME_FORMAT=%Y[ ]{1,2}%m[ ]{1,2}%d[ ]{1,2,3}%H[ ]{1,2}%M[ ]{1,2}%S
TIME_PREFIX=[ ]{4-10}
MAX_TIMESTAMP_LOOKAHEAD=50
SHOULD_LINEMERGE=false
NO_BINARY_CHECK=true
disabled=false
pulldown_type=true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm guessing that I should reformat the string in the config before trying to recognize the date fields? &lt;BR /&gt;
Any help would be appreciated. &lt;/P&gt;

&lt;P&gt;Thanks, &lt;BR /&gt;
Ken.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2015 10:03:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114667#M30347</guid>
      <dc:creator>kenvanderheyden</dc:creator>
      <dc:date>2015-01-29T10:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I keep getting an error extracting the timestamp from formatted text data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114668#M30348</link>
      <description>&lt;P&gt;update: &lt;/P&gt;

&lt;P&gt;I have tried the following: &lt;/P&gt;

&lt;P&gt;Added to the transforms.conf in the etc/local folder:&lt;/P&gt;

&lt;P&gt;[fixEarthquakeDates]&lt;BR /&gt;
REGEX = ([\d]{4})([\s]{1,2})([\d]{1,2})([\s]{1,2})([\d]{1,2})([\s]{1,3})([\d]{1,2})([\s]{1,3})([\d]{1,2})([\s]{1,3})([\d]{1})&lt;BR /&gt;
FORMAT = $1/$3/$5 $7:$9:$11&lt;BR /&gt;
DEST_KEY = _raw &lt;BR /&gt;
SOURCE_KEY = _raw&lt;/P&gt;

&lt;P&gt;And altered the props.conf as follows: &lt;/P&gt;

&lt;P&gt;[ earthquakes ]&lt;BR /&gt;
TIME_FORMAT=%Y/%m/%d %H:%M:S&lt;BR /&gt;
MAX_TIMESTAMP_LOOKAHEAD=0&lt;BR /&gt;
SHOULD_LINEMERGE=false&lt;BR /&gt;
NO_BINARY_CHECK=true&lt;BR /&gt;
disabled=false&lt;BR /&gt;
pulldown_type=true&lt;BR /&gt;
TRANSFORMS-timestamp=fixEarthquakeDates&lt;/P&gt;

&lt;P&gt;Still results in an error "failed to parse timestamp". &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:45:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114668#M30348</guid>
      <dc:creator>kenvanderheyden</dc:creator>
      <dc:date>2020-09-28T18:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I keep getting an error extracting the timestamp from formatted text data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114669#M30349</link>
      <description>&lt;P&gt;Your TIME_FORMAT string is incorrect.  It must use strptime() strings, not regex.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME_FORMAT = %Y %m %d %H %M %S.%2N
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jan 2015 13:00:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114669#M30349</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-01-29T13:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I keep getting an error extracting the timestamp from formatted text data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114670#M30350</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;Thanks for you answer, however it does not seem to be working. &lt;/P&gt;

&lt;P&gt;I have been experimenting with a small subset, altered data. &lt;BR /&gt;
This is my test data I am trying to import: &lt;/P&gt;

&lt;P&gt;ABE 1900    01  05  19  00  0.00    -3.000  102.000 7.0&lt;BR /&gt;
ABE 1900    01  11  09  07  0.00    -5.000  148.000 7.0&lt;BR /&gt;
UTSU    1900    01  18  07  46  0.00    44.500  148.500 6.7&lt;BR /&gt;
ABE 1900    01  20  06  33  0.00    20.000  -105.000    7.3&lt;BR /&gt;
UTSU    1900    01  31  19  22  0.00    48.000  146.000 7.5&lt;/P&gt;

&lt;P&gt;The fields are tab sepparated. &lt;BR /&gt;
There is no timestamp available according to the splunk import interface. &lt;/P&gt;

&lt;P&gt;So I'm trying to import the file, and assign a timestamp to the events, extracted from the sepparated date fields: year, month, day, ...&lt;/P&gt;

&lt;P&gt;I managed to transform the date fields into one field with any desired layout, an example: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[fixEarthquakeDates]
REGEX = (.{3,4})([\t]{1})([\d]{4})([\t]{1})([\d]{2})([\t]{1})([\d]{2})([\t]{1})([\d]{2})([\t]{1})([\d]{2})(.+)
FORMAT = $1$2$3-$5-$7 $9:$11:00.00 $12
DEST_KEY = _raw 
SOURCE_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Formats the data as follows: &lt;/P&gt;

&lt;P&gt;ABE    1900-01-05 19:00:00.00  0.00    -3.000  102.000 7.0&lt;BR /&gt;
 ABE    1900-01-11 09:07:00.00  0.00    -5.000  148.000 7.0&lt;BR /&gt;
 UTSU   1900-01-18 07:46:00.00  0.00    44.500  148.500 6.7&lt;BR /&gt;
 ABE    1900-01-20 06:33:00.00  0.00    20.000  -105.000    7.3&lt;/P&gt;

&lt;P&gt;Any other format can be achieved with the regex transformation. (I tried several alternatives).&lt;/P&gt;

&lt;P&gt;The error I keep getting is: &lt;BR /&gt;
Could not use strptime to parse timestamp from "1900 01 05 19 00 0.00 -3.000 102.000 7.0".&lt;BR /&gt;
Failed to parse timestamp. Defaulting to file modtime.&lt;/P&gt;

&lt;P&gt;Current settings :  &lt;/P&gt;

&lt;P&gt;MAX_TIMESTAMP_LOOKAHEAD=0&lt;BR /&gt;
NO_BINARY_CHECK=true&lt;BR /&gt;
SHOULD_LINEMERGE=false&lt;BR /&gt;
TIME_FORMAT=%Y %m %d %H %M %S.%2N&lt;BR /&gt;
TIME_PREFIX=\t&lt;BR /&gt;
TRANSFORMS-timestamp=fixEarthquakeDates&lt;BR /&gt;
TZ=UTC&lt;BR /&gt;
disabled=false&lt;BR /&gt;
pulldown_type=true&lt;/P&gt;

&lt;P&gt;Have been playing with numerous alternatives for the TIME_FORMAT, to no effect. &lt;/P&gt;

&lt;P&gt;Apparently the transformation happens after the parsing for a timestamp ? &lt;/P&gt;

&lt;P&gt;Can someone confirm this ? Or point me in the right direction ? &lt;/P&gt;

&lt;P&gt;Regards, &lt;BR /&gt;
Ken. &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:45:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114670#M30350</guid>
      <dc:creator>kenvanderheyden</dc:creator>
      <dc:date>2020-09-28T18:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I keep getting an error extracting the timestamp from formatted text data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114671#M30351</link>
      <description>&lt;P&gt;Please be sure that when responding to someone's answer, click on "Add comment" directly below their answer or, if responding to someone's comment, type in the "Add your comment..." box directly below their comment. You typed your response in the "Enter your answer here..." box at the very bottom of the page which, instead, posts a brand new answer when it was really meant as a comment. This will help with a clean continuous flow of the conversation. &lt;/P&gt;

&lt;P&gt;Your "answer" can no longer be converted to a comment since it is beyond the character limit. If you have a long response and are hitting a character limit when leaving a comment, just break it up into multiple comments. So unless @richgalloway subscribed to email notifications for your post, he won't know you responded to him unless you comment on his answer. Just something to keep in mind from here on out. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jan 2015 01:16:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114671#M30351</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2015-01-30T01:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I keep getting an error extracting the timestamp from formatted text data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114672#M30352</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;Thanks for your suggestion. &lt;BR /&gt;
I have been experimenting with it. &lt;/P&gt;

&lt;P&gt;Up to now I could not find a way to fix this issue. &lt;BR /&gt;
Keep seeing the error: &lt;BR /&gt;
Could not use strptime to parse timestamp from "1931/09/21 13:34:00 EHB ADEQ 37.961 177.811 6.6".&lt;BR /&gt;
Could not use regex to parse timestamp from "1931/09/21".&lt;/P&gt;

&lt;P&gt;The line below is the raw format of the text. It's a simple line of text, with a clear date and time format. &lt;BR /&gt;
Should be recognizable with %Y %m %d ... &lt;BR /&gt;
1931/09/21 13:34:00 EHB  ADEQ   37.961  177.811 6.6&lt;/P&gt;

&lt;P&gt;I have tried filling in strptime() formated search strings and regex patterns. none seem to be able to find the date. &lt;/P&gt;

&lt;P&gt;Open to suggestions from anyone. &lt;/P&gt;

&lt;P&gt;Regards, &lt;BR /&gt;
Ken. &lt;/P&gt;</description>
      <pubDate>Fri, 30 Jan 2015 08:06:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114672#M30352</guid>
      <dc:creator>kenvanderheyden</dc:creator>
      <dc:date>2015-01-30T08:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I keep getting an error extracting the timestamp from formatted text data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114673#M30353</link>
      <description>&lt;P&gt;Thanks, i will keep that in mind. &lt;/P&gt;

&lt;P&gt;Regards, &lt;BR /&gt;
Ken. &lt;/P&gt;</description>
      <pubDate>Fri, 30 Jan 2015 08:07:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114673#M30353</guid>
      <dc:creator>kenvanderheyden</dc:creator>
      <dc:date>2015-01-30T08:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I keep getting an error extracting the timestamp from formatted text data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114674#M30354</link>
      <description>&lt;P&gt;I found a small comment on this page that explained my issue: &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables&lt;/A&gt;&lt;BR /&gt;
Thanks Greg for sharing the comment ! &lt;/P&gt;

&lt;P&gt;Apparently dates prior to 1970/01/01 faile to get recognized in timestamp matching. &lt;BR /&gt;
Even if the regex or strptime string is correct, the date's are not recognized. &lt;/P&gt;

&lt;P&gt;Splunk team, please find a solution for this. After all "big data" often includes "old data". &lt;/P&gt;

&lt;P&gt;Regards, &lt;BR /&gt;
Ken. &lt;/P&gt;</description>
      <pubDate>Fri, 30 Jan 2015 08:31:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-do-I-keep-getting-an-error-extracting-the-timestamp-from/m-p/114674#M30354</guid>
      <dc:creator>kenvanderheyden</dc:creator>
      <dc:date>2015-01-30T08:31:39Z</dc:date>
    </item>
  </channel>
</rss>

