Asterisk log description - attributes

Hello comunity,

I would like to ask you for help with Asterisk log parsing. I was trying to find some information about each attribute in my log, but I am not getting everything. Please help me match what is “communication method, source port, destination port, message” and any other attributes.

My log looks like:

asterisk[19738]: VERBOSE[18717]: app_dial.c:1331 in wait_for_answer: – SIP/1C17D340FF32_0-0000b1b1 is ringing

asterisk[19738]: WARNING[18717]: app_dial.c:2341 in dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 - Unknown)

asterisk[19738]: VERBOSE[18717]: pbx.c:4240 in pbx_extension_helper: – Executing [374@phone-ext:41] Dial(“SIP/trunk-1-0000b1b0”, “SIP/1C17D340FF32_0&SIP/sochor,hktw”) in new stack

asterisk[19738]: VERBOSE[18717]: netsock2.c:505 in ast_set_qos: == Using SIP RTP TOS bits 184

asterisk[19738]: VERBOSE[18717]: app_dial.c:2486 in dial_exec_full: – Called SIP/1C17D340FF32_0

asterisk[19738]: VERBOSE[18717]: netsock2.c:527 in ast_set_qos: == Using SIP RTP CoS mark 5

asterisk[19738]: VERBOSE[18717]: pbx.c:4240 in pbx_extension_helper: – Executing [374@phone-ext:24] Set(“SIP/trunk-1-0000b1b0”, “GROUP_ID_DST=289”) in new stack

asterisk[19738]: VERBOSE[18717]: pbx.c:4240 in pbx_extension_helper: – Executing [374@phone-ext:12] GotoIf(“SIP/trunk-1-0000b1b0”, “0?forward”) in new stack

asterisk[19738]: VERBOSE[18717]: pbx.c:9853 in pbx_builtin_goto: – Goto (phone-ext,374,18)

asterisk[19738]: VERBOSE[18717]: pbx.c:4240 in pbx_extension_helper: – Executing [374@phone-ext:22] Set(“SIP/trunk-1-0000b1b0”, “EXT_ID_DST=1991”) in new stack

asterisk[19738]: VERBOSE[18717]: pbx.c:4240 in pbx_extension_helper: – Executing [374@phone-ext:25] Set(“SIP/trunk-1-0000b1b0”, “CONNECTEDLINE(name,i)=Sochor Martin”) in new stack

asterisk[19738]: VERBOSE[18717]: pbx.c:4240 in pbx_extension_helper: – Executing [374@phone-ext:11] Set(“SIP/trunk-1-0000b1b0”, “FORWARD_REASON=cfu”) in new stack

asterisk[19738]: VERBOSE[18717]: pbx.c:4240 in pbx_extension_helper: – Executing [374@phone-ext:23] Set(“SIP/trunk-1-0000b1b0”, “CALL_DST=1”) in new stack

asterisk[19738]: VERBOSE[18717]: pbx.c:4240 in pbx_extension_helper: – Executing [374@phone-ext:18] GotoIf(“SIP/trunk-1-0000b1b0”, “1?cdr”) in new stack

asterisk[19738]: VERBOSE[18717]: pbx.c:4240 in pbx_extension_helper: – Executing [record@functions:8] GotoIf(“SIP/trunk-1-0000b1b0”, “0?record”) in new stack

asterisk[19738]: VERBOSE[18717]: pbx.c:9853 in pbx_builtin_goto: – Goto (functions,record,5)

asterisk[19738]: VERBOSE[18717]: app_verbose.c:109 in verbose_exec: ** Processing call recording for extension ID 1991 **

thanks for help

The logs are not intended for machine parsing.

The information you are asking for is void in the log you provided as the call failed to look up details of the destination, so didn’t know what values to use.

Thank you David for answer. So If I am right, we need more logs? Or log displayed is not correct Queue Log? We can´t say which atribut is located on which position? In my log, there is no user hash? Source port? Destination port? ID? or Message which we can mark?

Jan

Sounds like you are using the diagnostic logs when you actually need one of the accounting type logs. (Queue Logs, CDRs, CELs)

However, those logs do not contain channel technology specific data such as IP ports. If the information doesn’t make sense for all of SIP, ISDN, and analogue lines, it is unlikely to be easy to get.

Can you explain why you need this data and what exactly you mean by “message” and “communication method”.

1 Like

Hello David,

what I mean, for example 1st row:

asterisk[19738]: VERBOSE[18717]: app_dial.c:1331 in wait_for_answer: – SIP/1C17D340FF32_0-0000b1b1 is ringing

If I know what means what, I can say:

Application_name=asterisk
Random_ID=19738
Log_Level=VERBOSE
Source_Port=18717
Communication_method=app_dial
Message=in wait_for_answer
and so…

For sure I am not right. But If I can find which string match witch attribute it realy helps me.

I still don’t understand what you are trying to achieve. That’s a human readable log message, not something that would usually be parsed by a machine.

Have you looked at Channel Event logging?

https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+CEL+Specification

or the CDR?

https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+CDR+Specification

Application_name=asterisk
Random_ID=19738
== Linux process ID of process invoking syslog call
Log_Level=VERBOSE
Source_Port=18717
== Linux process ID of thread within Asterisk calling ast_log()
Communication_method=app_dial
== app_dial.c is the name of the source file containing the call to ast_log()
== 1331 is the line number within that file where the particular call to ast_log() was made
== wait_for_answer is the name of the C language function containing the call to ast_log()
Message=in wait_for_answer
== The message is: SIP/1C17D340FF32_0-0000b1b1 is ringing

app_dial.c is the source file that implements the dialplan Dial application.
wait_for_answer is the function, within that, which waits for the call to be answered for to fail.

Note: "asterisk[19738]: " is added by syslog() and wouldn’t have appeared if you had looked at the Asterisk log files. From the point of view of syslog(), everything after the first space is message.

Just a side note, but if you are using Asterisk 14+ and want to programmatically parse the log files it might be helpful/easier to log the output in JSON. From logger.conf.sample:

; An optional formatter can be specified prior to the log levels sent
; to the log channel. The formatter is defined immediately preceeding the
; levels, and is enclosed in square brackets. Valid formatters are:
;   - [default] - The default formatter, this outputs log messages using a
;                 human readable format.
;   - [json]    - Log the output in JSON. Note that JSON formatted log entries,
;                 if specified for a logger type of 'console', will be formatted
;                 per the 'default' formatter for log messages of type VERBOSE.
;                 This is due to the remote consoles intepreting verbosity
;                 outside of the logging subsystem.

An example on how to specify it would be:

;full-json => [json]debug,verbose,notice,warning,error,dtmf,fax
3 Likes

Thank you David, that is what I need