[asterisk-bugs] [JIRA] (ASTERISK-25305) Dynamic logger channels can be added multiple times

Kevin Harwell (JIRA) noreply at issues.asterisk.org
Tue Sep 29 16:42:35 CDT 2015


     [ https://issues.asterisk.org/jira/browse/ASTERISK-25305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Harwell updated ASTERISK-25305:
-------------------------------------

    Target Release Version/s: 13.6.0

> Dynamic logger channels can be added multiple times
> ---------------------------------------------------
>
>                 Key: ASTERISK-25305
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25305
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Logging
>    Affects Versions: 13.4.0
>            Reporter: Mark Michelson
>      Target Release: 13.6.0
>
>
> The {{logger add channel}} command attempts to determine if the specified log channel exists before adding the new channel. Unfortunately, this does not work properly when relative paths are specified for the logger channel.
> If I run {{logger add channel bob debug}} then that will create a logger channel in the configured log directory (by default /var/log/asterisk/). If I run the command a second time, then the CLI command attempts to find if the channel exists already. Unfortunately, the comparison it runs is to check if "/var/log/asterisk/bob" matches "bob". Since this does not match, an identical logger channel is created. You can continue running the command as much as you want. The result can be something like:
> {noformat}
> *CLI> logger show channels 
> Channel                             Type     Status    Configuration
> -------                             ----     ------    -------------
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/bob               File     Enabled    - DEBUG 
> /var/log/asterisk/alice             File     Enabled    - NOTICE 
> /var/log/asterisk/bob               File     Enabled    - NOTICE 
> /var/log/asterisk/bob               File     Enabled    - NOTICE 
> /var/log/asterisk/full              File     Enabled    - DEBUG NOTICE WARNING ERROR VERBOSE DTMF FAX 
> /var/log/asterisk/messages          File     Enabled    - NOTICE WARNING ERROR 
>                                     Console  Enabled    - DEBUG NOTICE WARNING ERROR 
> {noformat}
> And if you check on the contents of the bob file after placing a call, you'll see something like:
> {noformat}
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> [Aug  5 14:26:45] DEBUG[15788] res_pjsip_session.c: Response is 200 OK
> {noformat}
> Yep, the message is written to the file once for each time that the bob channel shows up in the list of logger channels.
> The fix for this is to normalize the CLI input to match what the stored log channel will be, and then perform the comparison.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list