<?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: &amp;quot;Hit EOF while computing CRC&amp;quot; after logrotate runs in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100933#M21137</link>
    <description>&lt;P&gt;Looking at this now, seems like copytruncate could be the culprit.  Can anyone confirm or deny that?&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2011 23:26:35 GMT</pubDate>
    <dc:creator>jberry_lumos</dc:creator>
    <dc:date>2011-05-12T23:26:35Z</dc:date>
    <item>
      <title>"Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100929#M21133</link>
      <description>&lt;P&gt;Since upgrading to Spunk 4.2.1 last month, I'm having trouble with logrotate causing our light forwarders to stop monitoring our production logfiles.  I've added followTail = 1 and crcSalt = &lt;SOURCE&gt; to the inputs.conf file to try to keep Splunk monitoring the file even after it's been truncated to 0 bytes by logrotate, but I'm still seeing this error sporadically:&lt;/SOURCE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;05-12-2011 04:14:38.564 -0700 WARN  FileInputTracker - Hit EOF while computing CRC: totalread=0/thisread=0/shouldread=256/hashbytes=256/fdpos=0
05-12-2011 04:14:39.186 -0700 ERROR TailingProcessor - Ignoring path due to: Could not checksum file='/var/log/mongrel/production.log'.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is the relevant section of inputs.conf for this light forwarder:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///var/log/mongrel]
blacklist = \.gz$|csv_log|apn
disabled = false
followTail = 1
crcSalt = &amp;lt;SOURCE&amp;gt;
host = app5
sourcetype = Rails
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And here is &lt;CODE&gt;/etc/logrotate.d/mongrel&lt;/CODE&gt;, which controls the rotation of this log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/var/log/mongrel/*.log {
  daily
  missingok
  dateext
  rotate 7
  size 500M
  compress
  notifempty
  sharedscripts
  extension gz
  copytruncate
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's the section of inputs.conf that worked for us under Splunk 4.1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///var/log/mongrel]
blacklist = \.gz$|csv_log|apn
disabled = false
followTail = 0
host = app5
sourcetype = Rails
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Restarting splunk causes the file to be monitored again, but I'd like the forwarders to be able to survive the daily log rotation (as they used to with Splunk 4.1.)  Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2011 17:30:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100929#M21133</guid>
      <dc:creator>jberry_lumos</dc:creator>
      <dc:date>2011-05-12T17:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: "Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100930#M21134</link>
      <description>&lt;P&gt;The alwaysopenfile parameter is expensive, but would likely help in this scenario.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;alwaysOpenFile = [0|1]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/latest/Admin/Inputsconf"&gt;http://www.splunk.com/base/Documentation/latest/Admin/Inputsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I don't believe the crcsalt will help as it is stating the same file, but I could be wrong.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2011 22:33:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100930#M21134</guid>
      <dc:creator>Simeon</dc:creator>
      <dc:date>2011-05-12T22:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: "Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100931#M21135</link>
      <description>&lt;P&gt;Can you update with the relevant section of logrotate.conf?&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2011 23:11:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100931#M21135</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2011-05-12T23:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: "Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100932#M21136</link>
      <description>&lt;P&gt;It's possible there's a truncate scenario we don't yet handle cleanly.  I anti-recommend both crcSalt and followTail for the generic case.  I second the logrotate.conf information request.  Alternatively a story of the seqeunce of file operations would help.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2011 23:19:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100932#M21136</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2011-05-12T23:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: "Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100933#M21137</link>
      <description>&lt;P&gt;Looking at this now, seems like copytruncate could be the culprit.  Can anyone confirm or deny that?&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2011 23:26:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100933#M21137</guid>
      <dc:creator>jberry_lumos</dc:creator>
      <dc:date>2011-05-12T23:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: "Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100934#M21138</link>
      <description>&lt;P&gt;Also we should look at what you upgraded from, and how it was configured.  4.1 should behave the same way.  4.0 is quite different.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2011 23:30:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100934#M21138</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2011-05-12T23:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: "Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100935#M21139</link>
      <description>&lt;P&gt;In your logrotate config, &lt;CODE&gt;sharedscripts&lt;/CODE&gt; implies &lt;CODE&gt;create&lt;/CODE&gt; (so says &lt;CODE&gt;man logrotate&lt;/CODE&gt; on my ubuntu natty).  Depending on what your scripts do, this could be at odds with &lt;CODE&gt;copytruncate&lt;/CODE&gt;.  &lt;/P&gt;

&lt;P&gt;There are chances for a few different race conditions here.  With &lt;CODE&gt;copytruncate&lt;/CODE&gt;, while logrotate is making a copy of your logfile, Splunk could see the copy (before it gets gzipped) and try to index it.  With &lt;CODE&gt;crcSalt = &amp;lt;SOURCE&amp;gt;&lt;/CODE&gt; that could lead to some duplicate events.  (Depending on the timing)  Removing &lt;CODE&gt;copytruncate&lt;/CODE&gt; reduces the chances in that.  But, there could be a different timing condition where when you rename the existing log and gzip it Splunk could miss some events near EOF.&lt;/P&gt;

&lt;P&gt;With two shell scripts competing to add data to a log file and to rotate it as quickly as possible, I was able to make a handful of these race conditions happen.  Granted it is a bit of an unfair test, because you don't try to run &lt;CODE&gt;logrotate&lt;/CODE&gt; multiple times each minute.&lt;/P&gt;

&lt;P&gt;This is a little harder to do with logrotate, but procedure-wise the very cleanest approach is something like this:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Rename xxx.log to xxx.log.&lt;DATE&gt;&lt;/DATE&gt;&lt;/LI&gt;
&lt;LI&gt;Create a new xxx.log as a 0-byte file&lt;/LI&gt;
&lt;LI&gt;SIGHUP (or whichever signal it needs) mongrel to have it swap files&lt;/LI&gt;
&lt;LI&gt;Give Splunk "some time" (say 5 minutes) to "finish up" the log file named xxx.log.&lt;DATE&gt;.  It will notice the CRC and pick up where it left off.&lt;/DATE&gt;&lt;/LI&gt;
&lt;LI&gt;gzip xxx.log.&lt;DATE&gt;&lt;/DATE&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;This approach gives everyone what they are looking for, and minimizes the chances for race conditions and missed or duplicate events.  It also doesn't need &lt;CODE&gt;crcSalt = &amp;lt;SOURCE&amp;gt;&lt;/CODE&gt;, &lt;CODE&gt;followTail&lt;/CODE&gt; or &lt;CODE&gt;alwaysOpenFile&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 00:17:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100935#M21139</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2011-05-13T00:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: "Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100936#M21140</link>
      <description>&lt;P&gt;The file-in-creation situation could cause splunk to see a shorter version of the file, which we have to assume is new.&lt;/P&gt;

&lt;P&gt;The the crcSalt interaction will force us to reindex every time the file is reanamed (rolled), so it's just unwanted.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 00:37:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100936#M21140</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2011-05-13T00:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: "Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100937#M21141</link>
      <description>&lt;P&gt;It seems mongrel simply writes to stderr as its logging strategy with stderr already attached to a specific file.  This means that copy and truncate is the only option. Which is too bad, since it's a fundamental race condition to actually keep all your data and roll.&lt;/P&gt;

&lt;P&gt;stderr is pretty reasonable for low volume stuff that doesn't need to be rolled, but it's a poor choice for rolling.&lt;/P&gt;

&lt;P&gt;However the real world isn't so easy, and we can't dictate how apps work.  We need to look into that message, and I'll try to.  I think you should have a support case open if you don't already.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 00:55:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100937#M21141</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2011-05-13T00:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: "Hit EOF while computing CRC" after logrotate runs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100938#M21142</link>
      <description>&lt;P&gt;Thanks.  Still wonder why I wasn't seeing this with the older version, though it's possible this was happening and I just didn't notice.  I'll open a support ticket regarding the message.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 01:02:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/quot-Hit-EOF-while-computing-CRC-quot-after-logrotate-runs/m-p/100938#M21142</guid>
      <dc:creator>jberry_lumos</dc:creator>
      <dc:date>2011-05-13T01:02:38Z</dc:date>
    </item>
  </channel>
</rss>

