User Tools

Site Tools


cookbooks:devel:core

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
cookbooks:devel:core [2021/09/10 10:00]
henningw
cookbooks:devel:core [2021/11/16 09:30]
miconda [Log Engine CLI Parameter]
Line 7: Line 7:
 This tutorial collects the functions and parameters exported by Kamailio core to configuration file. This tutorial collects the functions and parameters exported by Kamailio core to configuration file.
  
-**Note:** The parameters on this page are **NOT** in alphabetical order. Test+**Note:** The parameters on this page are **NOT** in alphabetical order.
  
 ===== Structure ===== ===== Structure =====
Line 3949: Line 3949:
       * **A** - do not add log prefix       * **A** - do not add log prefix
       * **c** - add Call-ID (when available) as a dedicated JSON attribute       * **c** - add Call-ID (when available) as a dedicated JSON attribute
 +      * **j** - the log prefix and message fields are printed in JSON structure format, detecting if they are enclosed in between **{ }** or adding them as a **text** field
       * **M** - strip EOL ('\n') from the value of the log message field       * **M** - strip EOL ('\n') from the value of the log message field
       * **N** - do not add EOL at the end of JSON document       * **N** - do not add EOL at the end of JSON document
 +      * **p** - the log prefix is printed as it is in the root json document, it has to start with comma (**,**) and be a valid set of json fields
 +      * **U** - CEE (Common Event Expression) schema format - https://cee.mitre.org/language/1.0-beta1/core-profile.html
  
 Example of JSON logs when running Kamailio with "**--log-engine=json:M**" : Example of JSON logs when running Kamailio with "**--log-engine=json:M**" :
Line 3958: Line 3961:
  
 { "idx": 1, "pid": 18239, "level": "DEBUG", "module": "core", "file": "core/socket_info.c", "line": 644, "function": "grep_sock_info", "logprefix": "{1 1 OPTIONS 715678756@192.168.188.20} ", "message": "checking if host==us: 9==9 && [127.0.0.1] == [127.0.0.1]" } { "idx": 1, "pid": 18239, "level": "DEBUG", "module": "core", "file": "core/socket_info.c", "line": 644, "function": "grep_sock_info", "logprefix": "{1 1 OPTIONS 715678756@192.168.188.20} ", "message": "checking if host==us: 9==9 && [127.0.0.1] == [127.0.0.1]" }
 +</code>
  
 +Example config for printing log message with **j** flag:
 +
 +<code>
 +xinfo("{ \"src_ip\": \"$si\", \"method\": \"$rm\", \"text\": \"request received\" }");
 +</code>
 +
 +Example config for printing log messages with **p** flag:
 +
 +<code>
 +log_prefix=", \"src_ip\": \"$si\", \"tv\": $TV(Sn), \"mt\": $mt, \"ua\": \"$(ua{s.escape.common})\", \"cseq\": \"$hdr(CSeq)\""
 </code> </code>
cookbooks/devel/core.txt ยท Last modified: 2022/04/11 17:10 by bkaufman