<?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: monitor files query and configuration in Monitoring Splunk</title>
    <link>https://community.splunk.com/t5/Monitoring-Splunk/monitor-files-query-and-configuration/m-p/83979#M7315</link>
    <description>&lt;P&gt;So you are saying I should do something like this&lt;/P&gt;

&lt;P&gt;[monitor:////data/X/logs/.../A*.log]&lt;BR /&gt;
index = my_index&lt;BR /&gt;
sourcetype = product.a.log&lt;/P&gt;

&lt;P&gt;and that this will track A because the CRC of the header in old A.log and in A+date.log will be the same and so will notice extra entries appended t the bottom if they don't match? Is there a way to change the size of the CRC header size? The is a lot of xml being logged and it could be that the last 256 do not change between messages (though the file size will)&lt;/P&gt;</description>
    <pubDate>Mon, 05 Mar 2012 05:07:26 GMT</pubDate>
    <dc:creator>shaunwilde</dc:creator>
    <dc:date>2012-03-05T05:07:26Z</dc:date>
    <item>
      <title>monitor files query and configuration</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/monitor-files-query-and-configuration/m-p/83977#M7313</link>
      <description>&lt;P&gt;I am trying to configure Splunk to monitor a service that has some unusual (to me) logging behaviour (unfortunately re-writing the logging code is not an option as it is 3rd party)&lt;/P&gt;

&lt;P&gt;In folder X it creates several files &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;A.log &lt;/LI&gt;
&lt;LI&gt;B.log &lt;/LI&gt;
&lt;LI&gt;C.log&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;and appends to them.&lt;/P&gt;

&lt;P&gt;After 24 hours it &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;moves/copies A.log to old/A__&amp;lt; date_stamp &amp;gt;.log&lt;/LI&gt;
&lt;LI&gt;moves/copies B.log to old/B__&amp;lt; date_stamp &amp;gt;.log&lt;/LI&gt;
&lt;LI&gt;moves/copies C.log to old/C__&amp;lt; date_stamp &amp;gt;.log&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;and truncates/creates the original file again&lt;/P&gt;

&lt;P&gt;Questions:&lt;/P&gt;

&lt;P&gt;If I just monitor the original files i.e. A.log, ..., would it be possible that splunk may miss a logging event due to the event being written and the file being copied/truncated?&lt;/P&gt;

&lt;P&gt;If I try to monitor all the log files (so I never loose a message) can I wildcard it such that all A*.log events have a common sourcetype? &lt;/P&gt;

&lt;P&gt;If I can end up watching all the log files it is possible I'll have duplicate entries 1st from the orginal and the 2nd from the copy into the &lt;STRONG&gt;old&lt;/STRONG&gt; folder and if so is there a common/known strategy to handle that within splunk? &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:28:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/monitor-files-query-and-configuration/m-p/83977#M7313</guid>
      <dc:creator>shaunwilde</dc:creator>
      <dc:date>2020-09-28T11:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: monitor files query and configuration</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/monitor-files-query-and-configuration/m-p/83978#M7314</link>
      <description>&lt;P&gt;You probably want to monitor via a wildcard, unless your process pauses before rotating logs. &lt;/P&gt;

&lt;P&gt;Why?  If you use a wildcard to monitor a path, Splunk will index duplicates.  Splunk calculates a CRC of the file and uses that when keeping track of how far into a file it has read.  If the log is rotated, but still included in them monitor  stanza (i.e. via a wildcard) Splunk will know it has already read most of that file and only read anything it hasn't already indexed.  &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;NB:&lt;/STRONG&gt;  Caveats - This is not true if files are compressed as part of rotation.  If a wildcard includes compressed files, they should be blacklisted.  A generic blacklist might look something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;blacklist = \.(tar|gz|bz2|tar.gz|tgz|tbz|tbz2|zip|z)$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using crcSalt=&lt;SOURCE&gt; would also break this model.  For a more complete explanation of how Splunk handles log file rotation, check out &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/Howlogfilerotationishandled"&gt;said topic in the Getting Things in Manual&lt;/A&gt;.  &lt;/SOURCE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2012 04:44:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/monitor-files-query-and-configuration/m-p/83978#M7314</guid>
      <dc:creator>bwooden</dc:creator>
      <dc:date>2012-03-05T04:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: monitor files query and configuration</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/monitor-files-query-and-configuration/m-p/83979#M7315</link>
      <description>&lt;P&gt;So you are saying I should do something like this&lt;/P&gt;

&lt;P&gt;[monitor:////data/X/logs/.../A*.log]&lt;BR /&gt;
index = my_index&lt;BR /&gt;
sourcetype = product.a.log&lt;/P&gt;

&lt;P&gt;and that this will track A because the CRC of the header in old A.log and in A+date.log will be the same and so will notice extra entries appended t the bottom if they don't match? Is there a way to change the size of the CRC header size? The is a lot of xml being logged and it could be that the last 256 do not change between messages (though the file size will)&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2012 05:07:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/monitor-files-query-and-configuration/m-p/83979#M7315</guid>
      <dc:creator>shaunwilde</dc:creator>
      <dc:date>2012-03-05T05:07:26Z</dc:date>
    </item>
  </channel>
</rss>

