Yet another method to get dynamic logging level on Kamailio. Means to change logging level on the fly.
First to mention - already built-in method for Kamailio inside corex module. But this one could be very verbose.
Other method is to specify level in xlog command explicitly.
kamailio.cfg
#!KAMAILIO
# Level for realtime logging for messages. To see debug messages in realtime, set it to 2
realtime.debug_level=5
...
debug=2
...
request_route {
$var(debug_level) = $(sel(cfg_get.realtime.debug_level){s.int});
...
xlog("$var(debug_level)", "This is a debug message\n");
}
And than just adjust this debug_level config variable via shell
# kamcmd cfg.set realtime debug_level 2
to get all xlog messages to be printed, or set it to the greater value like
# kamcmd cfg.set realtime debug_level 5
to get em suppressed.
You can expand this method to have bigger levels of verbosity via different variables, but usually it's enough like this.
P.S.: Also, as an alternative (or build-in method) there is a possibility to use corex module functionality
No comments:
Post a Comment