Search code examples
node.jswinston

Winston Logger - Exclude logging to syslog for console Transport


I have a node app running on EC2 Redhat. It's logging to syslog, and the logs are getting too big. However the configuration, has not defined any syslog transport.

const logger = createLogger({
  // change level if in dev environment versus production
  level: env === "development" ? "verbose" : "info",
  format: format.combine(
    format.timestamp({
      format: "YYYY-MM-DD HH:mm:ss",
    }),
    format.printf((info) => `${info.timestamp} ${info.level}: ${info.message}`)
  ),
  transports: [
    new transports.Console({
      level: "info",
      format: format.combine(
        format.colorize(),
        format.printf(
          (info) => `${info.timestamp} ${info.level}: ${info.message}`
        )
      ),
    }),
    dailyRotateFileTransport,
  ],
})

Is there a way to disable logging to syslog? Ideally from the node app. But if not, from syslog configuration itself.


Solution

  • The following is what I did to resolve the space issue on my EC2.

    Set StandardOutput=null (previously it was set to journald by default, not from service file ) now it's set to null.

    enter image description here

    server - Avoid systemd unit (service) to be logged in journal - Ask Ubuntu https://askubuntu.com/questions/1200680/avoid-systemd-unit-service-to-be-logged-in-journal

    enter image description here

    linux - how to disable systemd service start/stop notifications - Unix & Linux Stack Exchange https://unix.stackexchange.com/questions/547790/how-to-disable-systemd-service-start-stop-notifications#comment1016825_547817