this post was submitted on 01 Aug 2024
660 points (98.5% liked)

linuxmemes

20688 readers
1143 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Pacmanlives@lemmy.world 3 points 1 month ago (1 children)

Actually something I never dug into. But does logrotate no longer work? I have a bunch of disk space these days so I would not notice large log files

[–] morethanevil@lemmy.fedifriends.social 2 points 1 month ago* (last edited 1 month ago) (1 children)

If logrotate doesn't work, than use this as a cronjob via sudo crontab -e Put this line at the end of the file:

0 0 * * * journalctl --vacuum-size=1G >/dev/null 2>&1

Everyday the logs will be trimmed to 1GB. Usually the logs are trimmed automatically at 4GB, but sometimes this does not work

[–] fallingcats@discuss.tchncs.de 5 points 1 month ago (1 children)

If we're using systemd already, why not a timer?

[–] morethanevil@lemmy.fedifriends.social 3 points 1 month ago (1 children)

Cron is better known than a systemd timer, but you can provide an example for the timer 😃

[–] fallingcats@discuss.tchncs.de 5 points 1 month ago* (last edited 1 month ago) (1 children)

Really, the correct way would be to set the limit you want for journald. Put this into /etc/systemd/journald.conf.d/00-journal-size.conf:

[Journal]
SystemMaxUse=50M

Or something like this using a timer: systemd-run --timer-property=OnCalender=daily $COMMAND

Thanks for this addition ☺️