Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Synapse is filling my systemd journal, while still keeping its own logs anyway #3171

Closed
ArchangeGabriel opened this issue May 2, 2018 · 5 comments

Comments

@ArchangeGabriel
Copy link
Contributor

I’m running Synapse 0.27.4 on ArchLinux.

Most of my journalctl ouptut is made of synapse entries. But I also have those logs under /var/lib/synapse/homeserver.log{,.[0-9]+}, and honestly I don’t need such a verbose output in my journald.

I’ve tried to find documentation on how to tweak logging, but failed to found any. I’ve found the following in my homeserver.yaml:

log_config: "/etc/synapse/<domain>.log.config"

This files contains:

version: 1

formatters:
  precise:
   format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s- %(message)s'

filters:
  context:
    (): synapse.util.logcontext.LoggingContextFilter
    request: ""

handlers:
  file:
    class: logging.handlers.RotatingFileHandler
    formatter: precise
    filename: /var/lib/synapse/homeserver.log
    maxBytes: 104857600
    backupCount: 10
    filters: [context]
    level: INFO
  console:
    class: logging.StreamHandler
    formatter: precise
    filters: [context]

loggers:
    synapse:
        level: INFO

    synapse.storage.SQL:
        level: INFO

root:
    level: INFO
    handlers: [file, console]

But I also have a /etc/synapse/log_config.yaml file with:

version: 1

# In systemd's journal, loglevel is implicitly stored, so let's omit it
# from the message text.
formatters:
    journal_fmt:
        format: '%(name)s: [%(request)s] %(message)s'

filters:
    context:
        (): synapse.util.logcontext.LoggingContextFilter
        request: ""

handlers:
    journal:
        class: systemd.journal.JournalHandler
        formatter: journal_fmt
        filters: [context]
        SYSLOG_IDENTIFIER: synapse

root:
    level: INFO
    handlers: [journal]

disable_existing_loggers: False

So what should I modify for synapse to not log everything to journald?

Thanks!

@Half-Shot
Copy link
Collaborator

As far as I'm aware, everything you log to console is logged to journal. You'll need to change the level and/or modules. The second file is not used I don't believe.

@ArchangeGabriel
Copy link
Contributor Author

So removing console from the first file should do it?

@Half-Shot
Copy link
Collaborator

Half-Shot commented May 2, 2018

Yep. Make sure to comment out/remove all references

@ArchangeGabriel
Copy link
Contributor Author

Thanks, this did it.

@Aster-the-Med-Stu
Copy link

Have you ever thought about change it as default settings? It is quite messy when one has to go through /var/log/messages

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants