Author: mjordan Date: Mon Jan 12 12:01:24 2015 New Revision: 430507 URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430507 Log: main/syslog: Allow dynamic logs, such as security events, to log to the syslog
The security event log uses a dynamic log level (SECURITY) that is registered with the Asterisk logging core. Unfortunately, the syslog would ignore log statements that had a dynamic log level associated with them. Because the syslog cannot handle ad hoc dynamic log levels, this patch treats any dynamic log entries sent to the syslog as logs with a level of NOTICE. ASTERISK-20744 #close Reported by: Michael Keuter Tested by: Michael L. Young, Jacek Konieczny patches: asterisk-20744-syslog-dynamic-logging_trunk.diff uploaded by Michael L. Young (license 5026) ........ Merged revisions 430506 from http://svn.asterisk.org/svn/asterisk/branches/11 Modified: branches/13/ (props changed) branches/13/include/asterisk/syslog.h branches/13/main/syslog.c Propchange: branches/13/ ------------------------------------------------------------------------------ --- branch-11-merged (original) +++ branch-11-merged Mon Jan 12 12:01:24 2015 @@ -1,1 +1,1 @@ -/branches/11:1-429517,429539,429632,429783,429804,429825,429867,429893,429982,430009,430126,430415,430487 +/branches/11:1-429517,429539,429632,429783,429804,429825,429867,429893,429982,430009,430126,430415,430487,430506 Modified: branches/13/include/asterisk/syslog.h URL: http://svnview.digium.com/svn/asterisk/branches/13/include/asterisk/syslog.h?view=diff&rev=430507&r1=430506&r2=430507 ============================================================================== --- branches/13/include/asterisk/syslog.h (original) +++ branches/13/include/asterisk/syslog.h Mon Jan 12 12:01:24 2015 @@ -27,6 +27,8 @@ #if defined(__cplusplus) || defined(c_plusplus) extern "C" { #endif + +#define ASTNUMLOGLEVELS 32 /*! * \since 1.8 Modified: branches/13/main/syslog.c URL: http://svnview.digium.com/svn/asterisk/branches/13/main/syslog.c?view=diff&rev=430507&r1=430506&r2=430507 ============================================================================== --- branches/13/main/syslog.c (original) +++ branches/13/main/syslog.c Mon Jan 12 12:01:24 2015 @@ -163,8 +163,16 @@ int ast_syslog_priority_from_loglevel(int level) { + /* First 16 levels are reserved for system use. + * Default to using LOG_NOTICE for dynamic logging. + */ + if (level >= 16 && level < ASTNUMLOGLEVELS) { + return LOG_NOTICE; + } + if (level < 0 || level >= ARRAY_LEN(logger_level_to_syslog_map)) { return -1; } + return logger_level_to_syslog_map[level]; } -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits
