By default, Sourcebot will output logs to the console in a human readable format. If you’d like Sourcebot to output structured JSON logs, set the following env vars:

  • SOURCEBOT_STRUCTURED_LOGGING_ENABLED (default: false): Controls whether logs are in a structured JSON format
  • SOURCEBOT_STRUCTURED_LOGGING_FILE: If structured logging is enabled and this env var is set, structured logs will be written to this file (ex. /data/sourcebot.log)

Structured log schema

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "title": "SourcebotLog",
    "properties": {
        "level": {
            "type": "string",
            "description": "The log level (error, warning, info, debug)"
        },
        "service": {
            "type": "string",
            "description": "The Sourcebot component that generated the log"
        },
        "message": {
            "type": "string",
            "description": "The log message"
        },
        "status": {
            "type": "string",
            "description": "The same value as the level field added for datadog support"
        },
        "timestamp": {
            "type": "string",
            "description": "The timestamp of the log in ISO 8061 format"
        }
    }
}