<?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 do I ingest rotated log files without the source filename changing? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-ingest-rotated-log-files-without-the-source-filename/m-p/419126#M94080</link>
    <description>&lt;P&gt;hi @marrette,&lt;/P&gt;

&lt;P&gt;Did the answer below solve your problem? If so, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help ya. &lt;/P&gt;

&lt;P&gt;Thanks for posting!&lt;/P&gt;</description>
    <pubDate>Mon, 08 Oct 2018 19:09:21 GMT</pubDate>
    <dc:creator>mstjohn_splunk</dc:creator>
    <dc:date>2018-10-08T19:09:21Z</dc:date>
    <item>
      <title>How do I ingest rotated log files without the source filename changing?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-ingest-rotated-log-files-without-the-source-filename/m-p/419124#M94078</link>
      <description>&lt;P&gt;I have several logs files on several hosts which ingest data from log files which are quite high volume (nearly as high as 2gb/hour on a big day) and are rotated every hour. On rotation the file name will change from Device_01.log to Device_01.log.2018-10-08-12&lt;/P&gt;

&lt;P&gt;The inputs.conf stanza is configured like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///path/to/logs/...]
disabled = false
followTail = 0
index = myIndex
whitelist =  .*\.log$|.*\.log\.\d\d\d\d-\d\d-\d\d-\d\d$
ignoreOlderThan = 1d
blacklist = .*ffdc_.*log|messages_.*log|exception_.*log|trace.*log|native*.log|activity.log|systemout*[0-9].log|systemout_.*log|.*-metrics\.[0-9]{1,3}\.log|\d+.\d+.\d+.\d+.\d+.\d+.log|-\d+-\d+-\d+.log
sourcetype = myApplication
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And this works - if Splunk isn't able to keep up with the data coming in before the file is rotated on the hour, it will open the renamed file and read the rest of the data from where it left off. But the source field of the renaming data will be the renamed file, not the actually log file name. So the following Splunk query will show the whole file if a wildcard is used:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=AppServer* index=myIndex source=/path/to/logs/Device_01.log*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...but it would be nice if Splunk would keep the source field named with the original file name, not the rolled filename.&lt;/P&gt;

&lt;P&gt;Is this possible to do? &lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Eddie&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:34:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-ingest-rotated-log-files-without-the-source-filename/m-p/419124#M94078</guid>
      <dc:creator>marrette</dc:creator>
      <dc:date>2020-09-29T21:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I ingest rotated log files without the source filename changing?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-ingest-rotated-log-files-without-the-source-filename/m-p/419125#M94079</link>
      <description>&lt;P&gt;You could create a props and transforms config to overwrite the value of the source field. Try something like below (regex might require some tweaking). Deploy this on your indexer(s) (or on your heavy forwarder if you use one for this data).&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[myApplication]
TRANSFORMS-setsource = myApp-setsource
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[myApp-setsource]
SOURCE_KEY = MetaData:Source
REGEX = (^[^\.]+\.log).*
DEST_KEY = MetaData:Source
FORMAT = source::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/lcKD4Y/1"&gt;https://regex101.com/r/lcKD4Y/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 06:44:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-ingest-rotated-log-files-without-the-source-filename/m-p/419125#M94079</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-10-08T06:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I ingest rotated log files without the source filename changing?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-ingest-rotated-log-files-without-the-source-filename/m-p/419126#M94080</link>
      <description>&lt;P&gt;hi @marrette,&lt;/P&gt;

&lt;P&gt;Did the answer below solve your problem? If so, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help ya. &lt;/P&gt;

&lt;P&gt;Thanks for posting!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 19:09:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-ingest-rotated-log-files-without-the-source-filename/m-p/419126#M94080</guid>
      <dc:creator>mstjohn_splunk</dc:creator>
      <dc:date>2018-10-08T19:09:21Z</dc:date>
    </item>
  </channel>
</rss>

