镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix log feedback loop in InitReboot capture on syslog-ng restarts - #102

Open
underd0se wants to merge 1 commit into
AMTM-OSR:developfrom
underd0se:fix/init-reboot-log-duplication
Open

underd0se wants to merge 1 commit into
AMTM-OSR:developfrom
underd0se:fix/init-reboot-log-duplication

Conversation

@underd0se

Copy link
Copy Markdown

Description

Fixes #101

When syslog symlinks (/tmp/syslog.log or /jffs/syslog.log) are broken, desynchronized by in-place edits (such as sed -i from firewall scripts), or checked during firmware service events, kill_logger in rc.func.syslog-ng assumed any non-symlink state was an unparsed boot log from stock syslogd.

As a result, it copied the active system log into syslogd.ScribeInitReboot.LOG. Because syslog-ng monitors this staging file via wildcard_file(), it re-ingested the entire log back into messages and remote syslog servers, creating a feedback loop that multiplied log entries on restarts and runtime service events.

Changes

  • init.d/rc.func.syslog-ng: Guard the log transfer block in kill_logger() so early boot logs are only copied into syslogd.ScribeInitReboot.LOG or messages during initial service start when syslog-ng is not yet running ([ -z "$($pidofCmd syslog-ng)" ] && "$serviceCallOK"). When syslog-ng is active or during runtime link maintenance (serviceCallOK=false), repair the broken symlink without copying active system log entries.
  • scribe.sh: Pass false to kill_logger in Check_Dir_Links to avoid treating routine link checks as fresh service starts.
  • scribe.sh: Truncate syslogd.ScribeInitReboot.LOG in SysLoggerCheck after syslog-ng has finished ingesting the initial boot logs.

Testing & Verification

  • Verified initial bootup logging path correctly captures pre-syslog-ng boot logs and converts /tmp/syslog.log to a symlink.
  • Verified runtime link repair (service_event and Check_Dir_Links) restores broken symlinks without copying active log data or polluting syslogd.ScribeInitReboot.LOG.
  • Verified with both SYSLOG_LOC=/tmp/syslog.log and SYSLOG_LOC=/jffs/syslog.log.

When syslog symlinks (`/tmp/syslog.log` or `/jffs/syslog.log`) are broken,
desynchronized by in-place edits (such as `sed -i` from firewall scripts),
or checked during firmware service events, `kill_logger` in `rc.func.syslog-ng`
assumed any non-symlink state was an unparsed boot log from stock `syslogd`.
As a result, it copied the active system log into `syslogd.ScribeInitReboot.LOG`.
Because `syslog-ng` monitors this staging file via `wildcard_file()`, it re-ingested
the entire log back into `messages` and remote syslog servers, creating a feedback
loop that multiplied log entries on restarts and runtime service events.

- `init.d/rc.func.syslog-ng`: Guard the log transfer block in `kill_logger()`
  so early boot logs are only copied into `syslogd.ScribeInitReboot.LOG` or
  `messages` during initial service start when `syslog-ng` is not yet running.
  When `syslog-ng` is active or during runtime link maintenance
  (`serviceCallOK=false`), repair the broken symlink without copying active
  system log entries.
- `scribe.sh`: Pass `false` to `kill_logger` in `Check_Dir_Links` to avoid treating
  link checks as fresh service starts.
- `scribe.sh`: Truncate `syslogd.ScribeInitReboot.LOG` in `SysLoggerCheck` after
  `syslog-ng` has ingested the initial boot logs.

Fixes AMTM-OSR#101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant