Peering Manager provides some loggers to make sure logs can be processed by any means a user may want to use. By default no logging is configured, a working example is provided below.
Available Loggers
Loggers are points where logs are sent for latter processing. The following loggers are provided:
peering.manager.devices
: logging internal models and viewspeering.manager.extras
: logging webhooks and otherpeering.manager.napalm
: logging actions done by NAPALMpeering.manager.net
: logging internal models and viewspeering.manager.netbox
: logging actions related to NetBoxpeering.manager.peering
: logging internal models and viewspeering.manager.peeringdb
: logging actions related to PeeringDBpeering.manager.releases
: logging new release monitoring
To adjust the logging configuration to your needs, you probably want to read
Django's documentation
about it. Have a look at
Python logging dictionary schema
as well. Apply any required LOGGING
modifications to
peering_manager/configuration.py
.
Example
This example will format logs using the simple
formatter defined below and
will separate logs in files depending of the loggers. Each file will contain a
day of logs, 5 days will be kept.
With this configuration, logs about releases will be displayed in the console
while logs about PeeringDB will be stored in the
/opt/peering-manager/logs/peeringdb.log
file.
LOGGING = {
"version": 1,
"formatters": {
"simple": {
"format": "%(asctime)s | %(levelname)s | %(message)s",
"datefmt": "%Y-%m-%d %H:%M:%S",
}
},
"handlers": {
"console": {"class": "logging.StreamHandler", "formatter": "simple"},
"peeringdb_file": {
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": "/opt/peering-manager/logs/peeringdb.log",
"when": "midnight",
"interval": 1,
"backupCount": 5,
"formatter": "simple",
},
},
"loggers": {
"peering.manager.peeringdb": {"handlers": ["peeringdb_file"], "level": "DEBUG"},
"peering.manager.releases": {"handlers": ["console"], "level": "DEBUG"},
},
}