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

NC | Noobaa syslogs are sent to two different files #8032

Open
naveenpaul1 opened this issue May 9, 2024 · 1 comment
Open

NC | Noobaa syslogs are sent to two different files #8032

naveenpaul1 opened this issue May 9, 2024 · 1 comment
Assignees
Labels
Non Containerized Non containerized NS-FS Type: Technical Debt Known technical gaps left in the system
Milestone

Comments

@naveenpaul1
Copy link
Contributor

naveenpaul1 commented May 9, 2024

Environment info

  • NooBaa Version: VERSION
  • Platform: Kubernetes 1.14.1 | minikube 1.1.1 | OpenShift 4.1 | other: specify

Actual behavior

debug_module sends every log message to two targets but but native code logs only to stderr at the moment.

  1. syslog facility local0 - rsyslog omfile copies it to /var/log/noobaa.log
  2. stdout/stderr - systemd copies it into its journal and then rsyslog imjournal copies it to the file /var/log/messages.
  3. send strerr to different log message.

Expected behavior

  1. Message should not be duplicated to /var/log/noobaa.log and /var/log/messages
  2. journal have rate limit for the messages(20,000 message per 10mnts), Once we stop sending message to journal this bottleneck can be avoided.

Steps to reproduce

  1. Install RPM and verify noobaa logs in /var/log/messages and /var/log/noobaa.log

More information - Screenshots / Logs / Other output

@naveenpaul1 naveenpaul1 changed the title NC | syslogs are sent twice NC | Noobaa syslogs are sent twice to two different files May 9, 2024
@romayalon romayalon added the Non Containerized Non containerized label May 9, 2024
@guymguym guymguym added the Type: Technical Debt Known technical gaps left in the system label May 9, 2024
@naveenpaul1 naveenpaul1 changed the title NC | Noobaa syslogs are sent twice to two different files NC | Noobaa syslogs are sent to two different files May 15, 2024
@nimrod-becker nimrod-becker added this to the 5.15.4 milestone May 22, 2024
@naveenpaul1
Copy link
Contributor Author

@guymguym @romayalon all the log messages are duplicated in both /logs/message and /logs/noobaa.log file. debug_module.log_internal() method writing logs to console using stderr or console after passing it to syslog. And these console logs are collected by imjournal and added to /logs/message log file. its fine for local testing but RPM its not that needed.
One solution would be set a config property to control these logs writing to the console. Logs will print added to console if its enabled, Something like this.

log_internal(msg_info) {
        if (syslog) {
            // syslog path
            syslog(this._levels_to_syslog[msg_info.level], msg_info.message_syslog, config.DEBUG_FACILITY);
        } else if (this._log_file) {
            // rotating file steam path (non browser)
            this._log_file.write(msg_info.message_file + os.EOL);
        }
        if (!config.ENABLE_WRITE_LOGS_TO_CONSOLE) return;   <---- New property to avoid log printing to console.
        // This is also used in order to log to the console
        // browser workaround, don't use rotating file steam. Add timestamp and level
        const logfunc = LOG_FUNC_PER_LEVEL[msg_info.level] || 'log';
        if (this._log_console_silent) {
            // noop
        } else if (console_wrapper) {
            process.stderr.write(msg_info.message_console + '\n');
        } else {
            console[logfunc](...msg_info.message_browser);
        }
        if (console_wrapper) {
            console_wrapper.wrapper_console();
        }
    }```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Non Containerized Non containerized NS-FS Type: Technical Debt Known technical gaps left in the system
Projects
None yet
Development

No branches or pull requests

4 participants