<?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 Set timestamp based on file source path in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91934#M19103</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I'm trying to set the timestamp for events from my source. My paths look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;C:\Users\angeliga\Filer\336033\gelica_2013-03-06_13-48-45\Server\file_to_index.txt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have read some answers on this subject here at splunk-base and on some other places. &lt;BR /&gt;
The suggestions that I've come across are to copy datetime.xml and modify it (&lt;A href="http://splunk-base.splunk.com/answers/40247/timestamp-from-file-name" target="_blank"&gt;from this splunk-base answer&lt;/A&gt;), or to do it in transforms.conf (&lt;A href="http://splunk-base.splunk.com/answers/59147/timestamp-base-on-filename" target="_blank"&gt;from this splunk-base answer&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;But I can't get it to work! &lt;/P&gt;

&lt;P&gt;It seems to me that the easiest way would be to use transforms.conf, but I can't figure out how to set the field correctly..&lt;/P&gt;

&lt;P&gt;I've also followed the exmples on how to modify datetime.xml, but when it looks like below, I get no events of that my_src_type! To figure out if I did something wrong when editing datetime.xml, I tried to just copy (no editing) it into my local folder and then set DATETIME_CONFIG = /etc/system/local/datetime.xml but it doesn't matter, I still get no events of my_src_type...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_src_type]
DATETIME_CONFIG = /etc/system/local/datetime.xml
other sourcetype stuff...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would also be able to extract the date, but I'm thinking that it would be the same approach?&lt;/P&gt;

&lt;P&gt;I hope someone can help me with this, it is very frustrating that I'm not able to make it work.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 14:18:51 GMT</pubDate>
    <dc:creator>gelica</dc:creator>
    <dc:date>2020-09-28T14:18:51Z</dc:date>
    <item>
      <title>Set timestamp based on file source path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91934#M19103</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I'm trying to set the timestamp for events from my source. My paths look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;C:\Users\angeliga\Filer\336033\gelica_2013-03-06_13-48-45\Server\file_to_index.txt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have read some answers on this subject here at splunk-base and on some other places. &lt;BR /&gt;
The suggestions that I've come across are to copy datetime.xml and modify it (&lt;A href="http://splunk-base.splunk.com/answers/40247/timestamp-from-file-name" target="_blank"&gt;from this splunk-base answer&lt;/A&gt;), or to do it in transforms.conf (&lt;A href="http://splunk-base.splunk.com/answers/59147/timestamp-base-on-filename" target="_blank"&gt;from this splunk-base answer&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;But I can't get it to work! &lt;/P&gt;

&lt;P&gt;It seems to me that the easiest way would be to use transforms.conf, but I can't figure out how to set the field correctly..&lt;/P&gt;

&lt;P&gt;I've also followed the exmples on how to modify datetime.xml, but when it looks like below, I get no events of that my_src_type! To figure out if I did something wrong when editing datetime.xml, I tried to just copy (no editing) it into my local folder and then set DATETIME_CONFIG = /etc/system/local/datetime.xml but it doesn't matter, I still get no events of my_src_type...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_src_type]
DATETIME_CONFIG = /etc/system/local/datetime.xml
other sourcetype stuff...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would also be able to extract the date, but I'm thinking that it would be the same approach?&lt;/P&gt;

&lt;P&gt;I hope someone can help me with this, it is very frustrating that I'm not able to make it work.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:18:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91934#M19103</guid>
      <dc:creator>gelica</dc:creator>
      <dc:date>2020-09-28T14:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Set timestamp based on file source path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91935#M19104</link>
      <description>&lt;P&gt;Add this line to props.conf file and extract the date from the directory name&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-sourcefields = \Users\angeliga\Filer\336033\gelica_(?&amp;lt;the_date&amp;gt;.*)\Server\file_to_index.txt in source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jul 2013 11:36:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91935#M19104</guid>
      <dc:creator>royimad</dc:creator>
      <dc:date>2013-07-11T11:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Set timestamp based on file source path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91936#M19105</link>
      <description>&lt;P&gt;Thanks for your answer, but I'm looking for a way to do this at index time, and make it the timestamp of the events in order to be able to use timechart and stuff easily.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2013 11:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91936#M19105</guid>
      <dc:creator>gelica</dc:creator>
      <dc:date>2013-07-11T11:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set timestamp based on file source path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91937#M19106</link>
      <description>&lt;P&gt;Did you check splunkd.log for any errors related to this time extraction? The timestamp processor is usually pretty good at telling why it's failing for one reason or another. Also I'm assuming you've read this docs page: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/HowSplunkextractstimestamps"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Data/HowSplunkextractstimestamps&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2013 12:02:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91937#M19106</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-07-11T12:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set timestamp based on file source path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91938#M19107</link>
      <description>&lt;P&gt;In case someone else have this problem, I didn't manage to get it working by using datetime.xml..&lt;BR /&gt;
Instead I used EVAL in props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EVAL-_time=strptime(file_name, "%Y-%m-%d_%H-%M-%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Probably not the most efficient way to do this, but it works for me for now. &lt;/P&gt;

&lt;P&gt;I'm still open to try another way if anyone has any solution.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2013 07:42:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91938#M19107</guid>
      <dc:creator>gelica</dc:creator>
      <dc:date>2013-07-19T07:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Set timestamp based on file source path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91939#M19108</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/130620"&gt;@gelica&lt;/a&gt;. I am currently having this same problem. I want the timestamp of the events of my log to be the timestamp on its filename. I see you have managed to do this and I have a question in your config. I tried your config here's mine: EVAL-_time=strptime(file_name, "%m-%d-%Y") and my filename is this: MTYP0-09-26-2013.log. I can't get the timestamp of the file. Hope you can help me on this&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:01:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91939#M19108</guid>
      <dc:creator>crt89</dc:creator>
      <dc:date>2020-09-28T16:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Set timestamp based on file source path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91940#M19109</link>
      <description>&lt;P&gt;@crt89 I'm not sure, and I'm not able to test since I'm not in that project anymore. &lt;BR /&gt;
The only thing that comes to my mind is that maybe file_name isn't what you think it is, have you double checked that?&lt;BR /&gt;
Good luck&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2014 12:03:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-timestamp-based-on-file-source-path/m-p/91940#M19109</guid>
      <dc:creator>gelica</dc:creator>
      <dc:date>2014-03-04T12:03:17Z</dc:date>
    </item>
  </channel>
</rss>

