0

I have a server running Phabricator and this log file has no logrotate.
It is getting too big and now I need to trim it. Can I safely remove some of its content?

carla
  • 317
  • 3
  • 12

1 Answers1

1

Your problem here is that more logs are actively appended to the end this file. Therefore, you'd lose some data or prevent logging during your modification. You can't just safely remove some content unless you stop all the services using this log file, probably all the daemons managed with phd.

You can safely move (mv, rename) the file and create a new one. That's actually what logrotate does automatically for you. It's safe to edit the rotated log file, but in the long run you'd prevent having this problem ever again by configuring the logrotate for the phd logs.

AFAIK Phabricator should already have this, but if it doesn't, you could add /etc/logrotate.d/phd:

/var/log/phd {
    daily
    compress
    missingok
    notifempty
    rotate 7
}

/var/log/phd/daemons.log {
    daily
    compress
    missingok
    notifempty
    rotate 7
}

Your path /var/tmp/phd/log/daemons.log is a bit different; modify accordingly.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122