Ubuntu – limit the size of ~/.xsession-errors

logxorg

Is there some way to limit size of .xsession-errors.?

I'm getting huge numbers of one particular debug information messages and it has blown the file size up to 2.8 GB (over many months). The message accounts for 95% of all the lines in .xsession-errors.

I think I know which app it is, and I'll have to look into that separately, but for now I'd like to know if there is a setting to prevent open-ended growth of the log..

The log is currently split over 2 files.. (0.8 GB and 2.0 GB)

UPDATE:
After applying RobinJ's suggestion of logrotate (which does keep the file size down), I noticed that after I manually deleted the 2.0 GB file .xsession-errors.old, it has re-appeared (size = 0) …

This means that something other than logrotate is managing this log file, in which case it seems that this other app may be able to manage the log's size limit, etc. and would be more appropriate..

What is this program?

===========
Post answer edit: My update actually changed the tone of the original question and Mark Russell has answered this second point very well…. RobinJ has answered my original question as per the title.. thanks to both..

Best Answer

  • logrotate should be able to do that.