[mythtv-users] Rotating log files (was Re: --logfile vs. --logpath)

Michael T. Dean mtdean at thirdcontact.com
Fri May 18 16:24:23 UTC 2012


On 05/18/2012 07:59 AM, Craig Treleaven wrote:
> At 5:10 PM -0400 5/17/12, Michael T. Dean wrote:
>> On 05/17/2012 03:23 PM, Richard Shaw wrote:
>>> On Thu, May 17, 2012 at 2:08 PM, Raymond Wagner wrote:
>>>> On 5/17/2012 14:06, Stephan Seitz wrote:
>>>>> I'm really wondering who thought the change from logfile to 
>>>>> logpath was
>>>>> a good idea. While you now have logfiles according to the name of
>>>>> process (e.g. mythbackend or mythpreviewgen), the names contain
>>>>> “cryptic" things like PID and date. How can you now configure any
>>>>> logrotation program to rotate the right logfiles?
>>>>
>>>> Wildcards and manual postrotate definitions.
>>>>
>>>> http://www.mythtv.org/wiki/Logrotate_-_mythfrontend
>>>> http://www.mythtv.org/wiki/Logrotate_-_mythbackend
>>> What I'd really like to see is a sane logrotate config for 
>>> mythpreviewgen... :)
>>
>> http://www.mythtv.org/wiki/Category:Log_Rotation_Configuration_Files
>>
>
> I've been doing some testing with 0.25 so I've never had the backend 
> running more than a few hours at a time. Correct me if I'm wrong, but 
> for mythpreviewgen, (and mythcommflag, and mythfilldatabase, I think) 
> the key is the following lines:
> lastaction
> find /var/log/mythtv/old -name 'mythpreviewgen*' -type f -mtime +30 
> -delete
> Each time one of these guys run, they create a new log file.

If you're using --logpath file logging, then, yes. If you're using 
syslog logging, and you've configured it to always write to a single 
file, then each time any mythpreviewgen instance is run, it will stick 
all its log output into that file (say, 
/var/log/mythtv/mythpreviewgen.log)--along with all the other 
mythpreviewgen instances' log output, including the 4 other instances of 
mythpreviewgen that are running at the exact same time (resulting in 
each line of the log file showing output from different mythpreviewgen 
runs, making a very confusing mess :).

> These logs don't need to be "rotated"--just pruned periodically. Right?

Right. Currently, we have the command set to keep the file for 30 days 
(and I plan to add text, eventually, to the pages that describe the 
various "configurable" options, such as this), primarily just to keep it 
the same as the mythbackend/mythfrontend "rotate" periods. However, if 
someone beats me to documenting some of these things, I won't complain... ;)

Note that the --syslog configuration keeps only the last 9 days worth of 
mythpreviewgen.log (primarily through the fact that it keeps 8 "old" 
rotated versions, and it runs daily.

> I think I'm going to add that to my daily db backup and optimization. 
> For me, I think 7 days of previewgens and commflags would be *lots*. 
> Maybe 14 days of mfd.

You're not running logrotate for other things, already? If not, you may 
want to consider it. (It or Rot[t]log, which I run, but I haven't posted 
any config files for it, yet, since I seem to be only one of 3 people 
actually using it.) MythTV can't be the only thing on your system 
writing out log messages...

> Does the backend and frontend continue to write to the same log file 
> for as long as they are running--potentially weeks or months?

Yes--or, technically, they write to the same log file name for as long 
as the instance runs. If you send a hangup signal, they will close and 
reopen the log files, so you can move the old file and then have it 
create a new (same-named) file (which will be a different file, since 
you've moved the old file to a different name). See the "After 
rotating..." section at 
http://www.mythtv.org/wiki/Category:Log_Rotation_Configuration_Files .

Mike


More information about the mythtv-users mailing list