XLOG module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”This module provides the possibility to print user formatted log or debug messages from OpenSIPS scripts, similar to printf function. A C-style printf specifier is replaced with a part of the SIP request or other variables from system. sec implemented specifiers shows what can be printed out.
Implemented Specifiers
Section titled “Implemented Specifiers”In the xlog function, you use pseudo-variables, that are a part of OpenSIPS core and are used by other modules as well (e.g., avpops in the function avp_printf())
The most important changes from earlier versions of OpenSIPS are:
-
- ’%’ has been replaced by ’$’
-
- to print a header, use now $hdr(header_name[index]) instead of %{header_name[index]}
-
- to print an AVP, use now $avp([si]:avp_id[index]) instead of %{[si]:avp_id[index]} or $avp([$avp_alias[index]) instead of %{[$avp_alias[index]}
The full list of available pseudo-variables in OpenSIPS is availabe at: http://opensips.org/dokuwiki/
Dependencies
Section titled “Dependencies”OpenSIPS Modules
Section titled “OpenSIPS Modules”The following modules must be loaded before this module:
- No dependencies on other OpenSIPS modules.
External Libraries or Applications
Section titled “External Libraries or Applications”The following libraries or applications must be installed before running OpenSIPS with this module loaded:
- None.
Exported Parameters
Section titled “Exported Parameters”buf_size (integer)
Section titled “buf_size (integer)”Maximum size of the log message.
Default value is 4096.
...modparam("xlog", "buf_size", 8192)...force_color (integer)
Section titled “force_color (integer)”When set to 1, forces color printing even if log_stderror=0.
Default value is 0.
...modparam("xlog", "force_color", 0)...Exported Functions
Section titled “Exported Functions”xlog([level,] format)
Section titled “xlog([level,] format)”Print a formated message using LOG function.
Meaning of the parameters are as follows:
-
level - The level that will be used in LOG function. It can be:
- L_ALERT - log level -3
- L_CRIT - log level -2
- L_ERR - log level -1
- L_WARN - log level 1
- L_NOTICE - log level 2
- L_INFO - log level 3
- L_DBG - log level 4
- $pv - any valid pseudo-variable, that has an integer value. See above options for valid log levels. If it is not a pseudo-variable, then what really matters is the third letter of the value. If the log level is higher than the “debug” global parameter, the message is not printed to syslog. If this parameter is missing, the implicit log level is ‘L_ERR’.
-
format - The formatted string to be printed.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE.
...xlog("L_ERR", "time [$Tf] method ($rm) r-uri ($ru) 2nd via ($hdr(via[1]))\n");...xlog("time [$Tf] method ($rm) r-uri ($ru) 2nd via ($hdr(via[1]))\n");...$var(loglevel) = 2;xlog("$var(loglevel)", "time [$Tf] method ($rm) r-uri ($ru)\n");...xdbg(format)
Section titled “xdbg(format)”Print a formatted message using DBG function.
Meaning of the parameters is as follows:
- format - The formatted string to be printed.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE.
...xdbg("time $Cbx[$Tf]$Cxx method ($rm) r-uri ($ru)\n");...Contributors
Section titled “Contributors”By Commit Statistics
Section titled “By Commit Statistics”Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
| # | Name | DevScore | Commits | Lines++ | Lines— |
|---|---|---|---|---|---|
| 1. | Daniel-Constantin Mierla (@miconda) | 52 | 18 | 509 | 1727 |
| 2. | Elena-Ramona Modroiu | 26 | 10 | 1378 | 233 |
| 3. | Bogdan-Andrei Iancu (@bogdan-iancu) | 15 | 10 | 147 | 142 |
| 4. | Elena-Ramona Modroiu | 8 | 5 | 146 | 42 |
| 5. | Jan Janak (@janakj) | 7 | 2 | 400 | 4 |
| 6. | Stefan Darius (@dariusstefan) | 6 | 3 | 190 | 20 |
| 7. | Jiri Kuthan (@jiriatipteldotorg) | 4 | 2 | 61 | 27 |
| 8. | Henning Westerholt (@henningw) | 4 | 2 | 10 | 10 |
| 9. | Andrei Pelinescu-Onciul | 4 | 2 | 8 | 5 |
| 10. | Anca Vamanu | 4 | 2 | 3 | 3 |
All remaining contributors: Andreas Heise, Razvan Crainea (@razvancrainea), Konstantin Bokarius, Edson Gellert Schubert.
(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding merge commits
(3) ignoring whitespace edits, renamed files and auto-generated files
By Commit Activity
Section titled “By Commit Activity”| # | Name | Commit Activity |
|---|---|---|
| 1. | Stefan Darius (@dariusstefan) | Jun 2026 - Jul 2026 |
| 2. | Razvan Crainea (@razvancrainea) | Jun 2026 - Jun 2026 |
| 3. | Bogdan-Andrei Iancu (@bogdan-iancu) | Aug 2005 - Jul 2008 |
| 4. | Henning Westerholt (@henningw) | Dec 2007 - Jun 2008 |
| 5. | Daniel-Constantin Mierla (@miconda) | Jun 2005 - Mar 2008 |
| 6. | Elena-Ramona Modroiu | Sep 2005 - Mar 2008 |
| 7. | Konstantin Bokarius | Mar 2008 - Mar 2008 |
| 8. | Edson Gellert Schubert | Feb 2008 - Feb 2008 |
| 9. | Anca Vamanu | Oct 2007 - Oct 2007 |
| 10. | Andreas Heise | Oct 2007 - Oct 2007 |
All remaining contributors: Elena-Ramona Modroiu, Jiri Kuthan (@jiriatipteldotorg), Jan Janak (@janakj), Andrei Pelinescu-Onciul.
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Bogdan-Andrei Iancu (@bogdan-iancu), Henning Westerholt (@henningw), Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Elena-Ramona Modroiu, Elena-Ramona Modroiu, Jan Janak (@janakj).
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0