#
# Configuration options for rsyslog / log handling
#
# weewxd.log - messages from the weewx daemon
# weewx.log  - messages from the weewx utilities
#
# This configuration file defaults to a traditional rsyslog configuration.
# However, it also includes examples for various other types of rsyslog
# configurations that might be better suited to specific rsyslog versions
# and/or operating system specifics.

# Default to old-style Property-Based Filters syntax for rsyslog
:programname,isequal,"weewx" /var/log/weewxd.log
:programname,isequal,"weewx" stop
:programname,startswith,"wee_" /var/log/weewx.log
:programname,startswith,"wee_" stop


## EXAMPLE 1:
## Rsyslog 'RainerScript' full syntax with multiple conditions
## 'RainerScript' has replaced the BSD syntax, but both are supported.
## Basic if...else support since v5, fully supported since v6
##
## The conditionals for 'journal' handle the case where the systemd journal
## is messing around with logging.  In that case, the programname is journal,
## and the log message will start with the actual programname.
##
#if $programname == "weewx" or ($programname == "journal" and $msg startswith "weewx") then {
#    /var/log/weewxd.log
#    stop
#}
#if $programname startswith "wee_" or ($programname == "journal" and $msg startswith "wee_") then {
#    /var/log/weewx.log
#    stop
#}


## EXAMPLE 2:
## A more basic 'RainerScript' syntax
##
#if $programname == 'weewx' then /var/log/weewxd.log
#if $programname == 'weewx' then stop
#if $programname startswith 'wee_' then /var/log/weewx.log
#if $programname startswith 'wee_' then stop

## Same example, but deal with systemd/journald
#if $programname == 'journal' and $msg startswith 'weewx' then /var/log/weewxd.log
#if $programname == 'journal' and $msg startswith 'weewx' then stop
#if $programname == 'journal' and $msg startswith 'wee_' then /var/log/weewx.log
#if $programname == 'journal' and $msg startswith 'wee_' then stop


## EXAMPLE 3 - deprecated:
## The tilde "~" discard action is deprecated, but supported, since v6
##
#:programname,isequal,"weewx" /var/log/weewxd.log
#:programname,isequal,"weewx" ~
#:programname,startswith,"wee_" /var/log/weewx.log
#:programname,startswith,"wee_" ~
