3

I'm using cygwin tail to follow busy java web application logs, on a windows server, generating roughly 16Gb worth of logs a day. I"m constrained to 10MB log sizes, so the files roll very often.

The command line I'm using is :

/usr/bin/tail -n 1000 -F //applicationserver/logs/logs.log

It survives 2-4 rolls of the file, about 4-6 minutes, but eventually, usually reports:

"File truncated" and then echos the name of the file every second. the file is busily filling and rotating. Am I exceeding the capability of tail?

John
  • 1,210

2 Answers2

1

Do you need the -n 1000? Won't that very quickly scroll off screen?

This is similar to How to do a `tail -f` of log rotated files?, but notice you're already using -F, which includes --retry.

Perhaps try --sleep-interval=1 to give tail less of a chance to miss the truncation? There doesn't appear to be a noticeable difference in my (admittedly) limited testing.

Bart
  • 2,221
  • -n 1000 does scroll off the screen, but that's ok, at the rate logs get filled, that's about a minute of logs, and if the server is in a stopped state, it's enough to scroll through to troubleshoot, quickly. I tried --sleep-interval=1, but that's really the default behavior, anyway. also added --max-unchanged-stats=1, tried both --follow types. started looking at the source to tail. – John Sep 12 '14 at 13:34
1

Switching to tailf achieved the results that I was looking for. No combination of tail switches worked to keep it running longer than a few log roll-overs.

John
  • 1,210