Logging can be configured by editing the following files:
docker-compose exec backend bash cd /var/log/artemis
smtps_handler: class: utils.SMTPSHandler level: INFO formatter: simple mailhost: - smtp.server.com - port fromaddr: from toaddrs: to subject: subject credentials: - username - password secure: True
slack_handler: class: slacker_log_handler.SlackerLogHandler api_key: SLACK_API_TOKEN channel: "#general" username: "Hijack Announcer" level: INFO ... (then to add it to a logger) hijack_logger: level: INFO handlers: [slack_handler] propagate: no
- artemis_logger: Output of all (backend) services.
- mail_logger: Triggered on new hijack events (targeted information to avoid spamming for mail services - only triggered on hijack events). For its current use, check this line.
- hijack_logger: Triggered for every hijack update (not only on first trigger). Be careful to avoid being overwhelmed with messages in case you attach a handler to it! Useful for monitoring the progress of a hijack in terms of incoming BGP updates.
- taps_logger: Logger for the monitoring services.
Note that you should attach a logger you would like to use. For example, after you configure the smtps log handler in lines 32-50 and optionally adding your custom formatter after line 5, you should add the smtps_handler to the mail_logger handlers here.
In general, the logging.yaml files, besides auxiliary information, contain 3 sections that you can adjust according to your logging needs:
- formatters, which define the format of a log message and are used in handlers
- handlers, which define how a log message should be handled (e.g., at which level of criticality)
- loggers, which define which handlers should be used and at which level of criticality
For a useful tutorial on logging using yaml configurations and how to use them in Python, we refer the user to this tutorial.
For further log customization, please check the following env variables here:
HIJACK_LOG_FILTER # for logging hijacks only with a certain community payload HIJACK_LOG_FIELDS # for selecting which hijack fields to show in the logs