Logging Configuration
Trapster Community Edition uses the logging configuration to set up logging for the application. The logging section contains the following configuration options:
Json logger (default)
The JsonLogger is the default logger for Trapster Community Edition. It logs events in JSON format to the standard output.
json
"logger": {
"name": "JsonLogger",
"kwargs": {}
}File logger
The FileLogger logs events to a file in JSON format. You can specify the log file path and the open mode. Use w+ to open the file in write mode and create it if it doesn't exist.
json
"logger": {
"name": "FileLogger",
"kwargs": {
"logfile": "/var/log/trapster-community.log",
"mode": "w+"
}
}API logger
The APILogger sends events to an API. You can specify the API endpoint URL and any headers:
json
"logger": {
"name": "APILogger",
"kwargs": {
"url": "https://example.com/api/v1/event/",
"headers": {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
}
}Redis logger
The RedisLogger logs events to a Redis database. You can specify the Redis host and port:
json
"logger": {
"name": "RedisLogger",
"kwargs": {
"host": "localhost",
"port": 6379
}
}