taf.plugins.pytest_syslogΒΆ

pytest_syslog.py

Plugin writes messages to SysLogHandler

Note

For correct functioning syslog should be properly configured, e.g.

  1. On device should be configured hostname seacliff9.

  2. The following lines should be added to syslog config:

    # This is criteria for seacliff messages
    if $hostname contains 'seacliff9' then /var/log/switches/seacliff09.log
    # This s criteria for our log messages
    if $msg contains 'seacliff9' and $programname == 'pytest_syslog' then /var/log/switches/seacliff9.log
    

Also it is good to configure logrotate (e.g. /etc/logrotate.d/switches) file of :

Examples:

/var/log/switches/*.log
{
    rotate 730
    weekly
    missingok
    notifempty
    delaycompress
    compress
    postrotate
        reload rsyslog >/dev/null 2>&1 || true
    endscript
}
Known issues:
  • rsyslog could miss log messages from remote host if it cannot resolve host FQDN 10 times. To disable dns resolving add -x option to /etc/default/rsyslog (for debian based distros).