From 2d7a4a3357cbaea7acd8fb202c28512980508c88 Mon Sep 17 00:00:00 2001 From: Matt Jordan Date: Mon, 21 Sep 2015 07:26:00 -0500 Subject: main/logger: Add log formatters and JSON structured logs 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 --- CHANGES | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'CHANGES') diff --git a/CHANGES b/CHANGES index 9d599f432..88743cc7b 100644 --- a/CHANGES +++ b/CHANGES @@ -115,6 +115,13 @@ Core names. This way one X.509 certificate can be used for hosts that can be reached under multiple DNS names or for multiple hosts. + * The Asterisk logging system now supports JSON structured logging. Log + channels specified in logger.conf or added dynamically via CLI commands now + support an optional specifier prior to their levels that determines their + formatting. To set a log channel to format its entries as JSON, a formatter + of '[json]' can be set, e.g., + full => [json]debug,verbose,notice,warning,error + Functions ------------------ -- cgit v1.2.3