Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
old-content:basic_openser_syslog_tutorial [2011/09/02 08:46] – 92.112.43.124 | old-content:basic_openser_syslog_tutorial [2012/03/22 12:41] (current) – removed spam 80.250.1.245 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Basic OpenSER Logging ====== | ||
+ | |||
+ | This is a way to setup syslog logging for OpenSER. This setup was based on Slackware 10.2, so your configuration may need to be modified for your distribution. | ||
+ | |||
+ | ===== Configuration ===== | ||
+ | |||
+ | ==== OpenSER Configuration ==== | ||
+ | |||
+ | First, set these configuration options in your openser.cfg: | ||
+ | |||
+ | < | ||
+ | debug=3 | ||
+ | log_facility=LOG_LOCAL7 | ||
+ | |||
+ | loadmodule "/ | ||
+ | </ | ||
+ | |||
+ | ==== Syslog Configuration ==== | ||
+ | |||
+ | Next, modify your syslog.conf (should be in / | ||
+ | |||
+ | < | ||
+ | # OpenSER messages, make sure this spacing is done with tabs, spaces may cause errors | ||
+ | local7.*; | ||
+ | </ | ||
+ | |||
+ | Create the log file: | ||
+ | |||
+ | < | ||
+ | |||
+ | Now, in OpenSER, to do some custom logging within your route (it will still catch all regular output from OpenSER, of course), I like to use xlog. Regular log will work, too. | ||
+ | |||
+ | ==== Extra Logging in OpenSER ==== | ||
+ | |||
+ | < | ||
+ | xlog(" | ||
+ | </ | ||
+ | |||
+ | The first argument sets the level of the logging, and the next is the message. | ||
+ | |||
+ | ===== Log Rotation ===== | ||
+ | |||
+ | ==== logrotate.conf ==== | ||
+ | |||
+ | Within / | ||
+ | |||
+ | < | ||
+ | # / | ||
+ | # | ||
+ | # logrotate is designed to ease administration of systems that generate large | ||
+ | # numbers of log files. | ||
+ | # mailing of log files. | ||
+ | # when it grows too large. | ||
+ | # | ||
+ | # logrotate is normally run daily from root's crontab. | ||
+ | # | ||
+ | # For more details, see "man logrotate" | ||
+ | |||
+ | # rotate log files weekly: | ||
+ | weekly | ||
+ | |||
+ | # keep 4 weeks worth of backlogs: | ||
+ | rotate 4 | ||
+ | |||
+ | # create new (empty) log files after rotating old ones: | ||
+ | create | ||
+ | |||
+ | # uncomment this if you want your log files compressed: | ||
+ | #compress | ||
+ | |||
+ | # some packages install log rotation information in this directory: | ||
+ | include / | ||
+ | |||
+ | # Rotate / | ||
+ | / | ||
+ | monthly | ||
+ | create 0664 root utmp | ||
+ | rotate 1 | ||
+ | } | ||
+ | |||
+ | # Note that / | ||
+ | # not be. The lastlog file is a database, and is also a sparse file that takes | ||
+ | # up much less space on the drive than it appears. | ||
+ | |||
+ | # system-specific logs may be also be configured below: | ||
+ | </ | ||
+ | |||
+ | ==== / | ||
+ | |||
+ | Each distribution may be different, but in Slackware 10.2, I created a the file / | ||
+ | |||
+ | I filled it with these parameters: | ||
+ | |||
+ | < | ||
+ | / | ||
+ | sharedscripts | ||
+ | postrotate | ||
+ | /bin/kill -HUP `cat / | ||
+ | endscript | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Finally, restart OpenSER and enjoy! | ||
+ | |||
+ | Questions and corrections, | ||