Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The frr.log file is empty after rotating log #15818

Open
2 tasks done
secretdeveloperisme opened this issue Apr 23, 2024 · 2 comments
Open
2 tasks done

The frr.log file is empty after rotating log #15818

secretdeveloperisme opened this issue Apr 23, 2024 · 2 comments
Assignees
Labels
triage Needs further investigation

Comments

@secretdeveloperisme
Copy link

Description

I have set up the FRR to ensure that all daemon processes, such as zebra, ospfd, bgpd, etc., log their output to the /var/log/frr.log file. However, I've observed that whenever logrotate performs its rotation on frr.log, the newly created file is empty.

Version

The issue is present in version 8.3.1 and may also occur in newer versions.

How to reproduce

  1. Configure the daemons such as zebra, bgpd, osfpd... log into the /var/log/frr/frr.log file
  2. Waiting for the rotation log
  3. Check content of the frr.log file

Expected behavior

After rotation, the newly created file is no longer empty.

Actual behavior

the frr.log is empty
image

Additional context

Upon examining the /etc/logrotate.d/frr file, I found the following configuration:

/var/log/frr/frr.log {
    notifempty
    missingok
    postrotate
        /bin/kill -HUP `cat /var/run/*syslog*.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

Currently, the postrotate script only sends the HUP signal to syslog. Should we be sending the USR1 signal instead to inform the daemons that are utilizing frr.log?

Checklist

  • I have searched the open issues for this bug.
  • I have not included sensitive information in this report.
@secretdeveloperisme secretdeveloperisme added the triage Needs further investigation label Apr 23, 2024
@eqvinox eqvinox self-assigned this Apr 23, 2024
@eqvinox
Copy link
Contributor

eqvinox commented Apr 23, 2024

Currently, the postrotate script only sends the HUP signal to syslog. Should we be sending the USR1 signal instead to inform the daemons that are utilizing frr.log?

Yes, that's exactly what would cause this, without USR1 to the daemons they keep logging to the previous file so the new one will remain empty.

The logrotate config shipped with FRR is intended for the "default" log syslog config, it needs the exact change you're describing to work with log file.

P.S.: 8.3 is really old at this point; we fixed at least one other issue where old logs were being kept open that might still be a problem in 8.3. If you see the old files being held open and/or still being logged to, you'll need to either update or manually backport fixes (as 8.3 is way out of community support…)

@secretdeveloperisme
Copy link
Author

I think the issue may occur in lasted version because the file redhat/frr.logrotate is very similar with 8.3.
Should we update the file in source code or provide document to help user update it manually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs further investigation
Projects
None yet
Development

No branches or pull requests

2 participants