Skip to content
Snippets Groups Projects
  • Matt Jordan's avatar
    2d7a4a33
    main/logger: Add log formatters and JSON structured logs · 2d7a4a33
    Matt Jordan authored
    When Asterisk is part of a larger distributed system, log files are often
    gathered using tools (such as logstash) that prefer to consume information
    and have it rendered using other tools (such as Kibana) that prefer a
    structured format, e.g., JSON. This patch adds support for JSON formatted
    logs by adding support for an optional log format specifier in Asterisk's
    logging subsystem. By adding a format specifier of '[json]':
    
    full => [json]debug,verbose,notice,warning,error
    
    Log messages will be output to the 'full' channel in the following
    format:
    
    {
      "hostname": Hostname or name specified in asterisk.conf
      "timestamp": Date/Time
      "identifiers": {
        "lwp": Thread ID,
        "callid": Call Identifier
      }
      "logmsg": {
        "location": {
          "filename": Name of the file that generated the log statement
          "function": Function that generated the log statement
          "line": Line number that called the logging function
        }
        "level": Log level, e.g., DEBUG, VERBOSE, etc.
        "message": Actual text of the log message
      }
    }
    
    ASTERISK-25425 #close
    
    Change-Id: I8649bfedf3fb7bf3138008cc11565553209cc238
    2d7a4a33
    History
    main/logger: Add log formatters and JSON structured logs
    Matt Jordan authored
    When Asterisk is part of a larger distributed system, log files are often
    gathered using tools (such as logstash) that prefer to consume information
    and have it rendered using other tools (such as Kibana) that prefer a
    structured format, e.g., JSON. This patch adds support for JSON formatted
    logs by adding support for an optional log format specifier in Asterisk's
    logging subsystem. By adding a format specifier of '[json]':
    
    full => [json]debug,verbose,notice,warning,error
    
    Log messages will be output to the 'full' channel in the following
    format:
    
    {
      "hostname": Hostname or name specified in asterisk.conf
      "timestamp": Date/Time
      "identifiers": {
        "lwp": Thread ID,
        "callid": Call Identifier
      }
      "logmsg": {
        "location": {
          "filename": Name of the file that generated the log statement
          "function": Function that generated the log statement
          "line": Line number that called the logging function
        }
        "level": Log level, e.g., DEBUG, VERBOSE, etc.
        "message": Actual text of the log message
      }
    }
    
    ASTERISK-25425 #close
    
    Change-Id: I8649bfedf3fb7bf3138008cc11565553209cc238
To find the state of this project's repository at the time of any of these versions, check out the tags.