Should logs in /var/webmin be auto-managed?

(I’m feeling particularly dumb, having panicked when my *min partition filled… benign neglect is NOT a good thing! I had to go to backup due to deleting crucial stuff…and then didn’t even copy other crucial post-backup files. Sigh.)

I just discovered a set of log files on my *min system that have never been truncated, ever since I first set this up four years ago. Some of the files are QUITE large now. :frowning:

QUESTION: what admin (script?) am I missing?

NOTES:

  • webmin.debug and webmin.debug.0 are only a few days old
  • lookup-domain-daemon.log started Aug 2024
  • The rest go wayyy back
-rw-r--r--    1 root root    2722580 Jun 30 10:13 webmin.debug
-rw-r--r--    1 root root    9719126 Jun 30 10:13 lookup-domain-daemon.log
-rw-------    1 root root   10547700 Jun 30 10:08 miniserv.log
-rw-r--r--    1 root root   12129745 Jun 30 10:13 webmin.debug.0
-rw-------    1 root root  150428414 Jun 30 10:10 webmin.log
-rw-r--r--    1 root root 4969372906 Jun 30 10:08 miniserv.error
SYSTEM INFORMATION
Operating system Debian Linux 11
Webmin version [2.302]

Have a look at “Webmin ⇾ Webmin Configuration: Logging” page.

Thanks! I never touched this before, which tells me the default is or was:

  • Log all actions by all users
  • Never clear logs

I could believe that this default has been changed. If so, a suggestion for future such fixes:

  • in addition to any release notes (which are hard for everyone to always read carefully :wink: )…
  • perhaps changes that require admin action to fix on existing systems ought to produce some kind of live notification during the update?

@Jamie, do we really have it set to “never clean” by default?

That doesn’t seem ideal! I will take a look …

Wow actually we do not enable log clearing by default! How long do you think we should keep logs for in a new install?

Anything less than 30 days or anything more than six months is probably not a good default.

Also, can I say that “hours” for log retention is a weird choice.

1 Like

The setting only seems to be effecting the miniserv.log. I set it to one hour and I still see logs from aug 2024 in the webmin.log. There also other logs not getting effected like the lookup-domain-daemon.log (getting large), can that be cleared as well

P.S. Just looked again and webmin.log has been purged, but other have not.

1 Like

unless folk are aware of them what is the point of a log that is never used.

A log has to be both known and used to have any purpose - at which point it should have some clear policy (documented) for its removal/cleaning/backup from the system. :rescue_worker_s_helmet:

As long as the default is long enough to see patterns. Most users will not change this setting but will one day need logs.

Never clearing logs is not good. :blush:

Max 6 months as @joe said is probably good.

1 Like

Is there a way to force a clean manually? This seems useful. :wink:

Perhaps even better: how about incorporating these logs into the logrotate system? I do like to keep many old logs around (NOT all). I have email logs going back many years…

Yeah, we set it to 168 hours in the setup.sh script, which I think is a pretty standard log retention period of 7 days.

Though, we never enabled it—check out this patch.

Also, could you possibly fix the issue of saving variables to both files, i.e. miniserv.conf and config? We could read miniserv.conf from webmin_log—what’s the point of this complexity by adding options to both files?

I think Jamie chose hours to account for debug logs, since they can fill up really fast.

@MrPete It looks like you can add them to the Webmin > System > Log File Rotation module if you want. That module has a button to Force Log Rotation individually or global.

@Ilia Does this conflict with

Have a look at “Webmin ⇾ Webmin Configuration: Logging” page.

As with any other service: Delete the log file (or move it), and restart the service (or SIGHUP or whatever, but Webmin restarts basically instantly, so that’s how Webmin applies changes to Webmin).

When log cleaning is enabled in Webmin, it automatically trims the logs. Log rotation is a different kind of feature.

I’m just thinking:

  • Whatever the “clean” script is, if we are able to run that script manually, it enables us to see what actually gets cleaned…
  • AND, allows cleanly resetting the logs that need cleaning.

This may be particularly important when setting the clean interval to a few months. I have a hunch that interval might be set to N (hours/months) in the future, not “clean now, then wait X time.”

That’s because Webmin CGIs and Miniserv each write their own separate log files, so clearing has to be done in two places.

Could you double-check that it actually works at all? I mean, even if it’s explicitly enabled, do your miniserv.error files get cleared?

And, what does “Periodically clear log files” actually mean? Are the files cleared completely, or does it keep logs for a set period (like keeping the last 7 days if set to 168 hours)?

Turns out that the error log was never being cleared! My latest commit fixes this though..

1 Like