Mailing List Archive

Static and dynamic configuration of rsyslog - problem with error "STOP is followed by unreachable statements!"
Hello everyone,

I have noticed that it is not possible to put commands after a "stop"
anymore. In such a case we have the following error : "STOP is followed by
unreachable statements". It has been confirmed severa times namely through
this post : https://github.com/rsyslog/rsyslog/issues/3668

In version 8.22.0, I used this feature to stop parsing the rsyslog.conf
file standard directives and use the dynamic ones set by my program. I did
this because, until my program is not started, I want rsyslog to log
everything the standard way.

Here is how I did it:

- Inside the standard rsyslog.conf file, I just replaced *$IncludeConfig
/etc/rsyslog.d/*.conf* with a volatile memory temporary folder
*$IncludeConfig
/tmp/syslog/*.conf*

Thus

1. Until my program is not running, There is no conf files inside
*$IncludeConfig
/tmp/syslog/*.conf * and so rsyslog uses the standard way

#### RULES (Not processed when my program is runnning)####

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.debug;mail.none;authpriv.none;cron.none /var/log/messages

# The authpriv file has restricted access.
authpriv.* /var/log/secure

# Log all the mail messages in one place.
mail.* /var/log/maillog

that
# Log cron stuff
cron.* /var/log/cron

# Everybody gets emergency messages
*.emerg :omusrmsg:*

# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler

# Save boot messages also to boot.log
local7.* /var/log/boot.log

2. My program populates *$IncludeConfig /tmp/syslog/ *with several conf
files for different targets and facilities. At the end, it creates a file
only containing "STOP" command that prevents rsyslog to continue processing
the standard rules

It's a shame that "STOP is followed by unreachable statements" is an error
and not a warning... Thus I could have let my program as it is ;-)...

Anyway, I'm opened to change the way I did. Any suggestion would be welcomed

Best regards,

Thomas
_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.
Re: Static and dynamic configuration of rsyslog - problem with error "STOP is followed by unreachable statements!" [ In reply to ]
I hadn't thought there was a legit use case for this, but you have a
point. Looking at the quoted thread, I would also tend to say the
message should be a warning:

https://github.com/rsyslog/rsyslog/issues/3668#issuecomment-493107691

Rainer

El mié., 26 ago. 2020 a las 12:32, Thomas Spitz via rsyslog
(<rsyslog@lists.adiscon.com>) escribió:
>
> Hello everyone,
>
> I have noticed that it is not possible to put commands after a "stop"
> anymore. In such a case we have the following error : "STOP is followed by
> unreachable statements". It has been confirmed severa times namely through
> this post : https://github.com/rsyslog/rsyslog/issues/3668
>
> In version 8.22.0, I used this feature to stop parsing the rsyslog.conf
> file standard directives and use the dynamic ones set by my program. I did
> this because, until my program is not started, I want rsyslog to log
> everything the standard way.
>
> Here is how I did it:
>
> - Inside the standard rsyslog.conf file, I just replaced *$IncludeConfig
> /etc/rsyslog.d/*.conf* with a volatile memory temporary folder
> *$IncludeConfig
> /tmp/syslog/*.conf*
>
> Thus
>
> 1. Until my program is not running, There is no conf files inside
> *$IncludeConfig
> /tmp/syslog/*.conf * and so rsyslog uses the standard way
>
> #### RULES (Not processed when my program is runnning)####
>
> # Log all kernel messages to the console.
> # Logging much else clutters up the screen.
> #kern.* /dev/console
>
> # Log anything (except mail) of level info or higher.
> # Don't log private authentication messages!
> *.debug;mail.none;authpriv.none;cron.none /var/log/messages
>
> # The authpriv file has restricted access.
> authpriv.* /var/log/secure
>
> # Log all the mail messages in one place.
> mail.* /var/log/maillog
>
> that
> # Log cron stuff
> cron.* /var/log/cron
>
> # Everybody gets emergency messages
> *.emerg :omusrmsg:*
>
> # Save news errors of level crit and higher in a special file.
> uucp,news.crit /var/log/spooler
>
> # Save boot messages also to boot.log
> local7.* /var/log/boot.log
>
> 2. My program populates *$IncludeConfig /tmp/syslog/ *with several conf
> files for different targets and facilities. At the end, it creates a file
> only containing "STOP" command that prevents rsyslog to continue processing
> the standard rules
>
> It's a shame that "STOP is followed by unreachable statements" is an error
> and not a warning... Thus I could have let my program as it is ;-)...
>
> Anyway, I'm opened to change the way I did. Any suggestion would be welcomed
>
> Best regards,
>
> Thomas
> _______________________________________________
> rsyslog mailing list
> https://lists.adiscon.net/mailman/listinfo/rsyslog
> http://www.rsyslog.com/professional-services/
> What's up with rsyslog? Follow https://twitter.com/rgerhards
> NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.
_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.
Re: Static and dynamic configuration of rsyslog - problem with error "STOP is followed by unreachable statements!" [ In reply to ]
check here: https://github.com/rsyslog/rsyslog/pull/4391

Rainer

El mié., 26 ago. 2020 a las 13:15, Rainer Gerhards
(<rgerhards@hq.adiscon.com>) escribió:
>
> I hadn't thought there was a legit use case for this, but you have a
> point. Looking at the quoted thread, I would also tend to say the
> message should be a warning:
>
> https://github.com/rsyslog/rsyslog/issues/3668#issuecomment-493107691
>
> Rainer
>
> El mié., 26 ago. 2020 a las 12:32, Thomas Spitz via rsyslog
> (<rsyslog@lists.adiscon.com>) escribió:
> >
> > Hello everyone,
> >
> > I have noticed that it is not possible to put commands after a "stop"
> > anymore. In such a case we have the following error : "STOP is followed by
> > unreachable statements". It has been confirmed severa times namely through
> > this post : https://github.com/rsyslog/rsyslog/issues/3668
> >
> > In version 8.22.0, I used this feature to stop parsing the rsyslog.conf
> > file standard directives and use the dynamic ones set by my program. I did
> > this because, until my program is not started, I want rsyslog to log
> > everything the standard way.
> >
> > Here is how I did it:
> >
> > - Inside the standard rsyslog.conf file, I just replaced *$IncludeConfig
> > /etc/rsyslog.d/*.conf* with a volatile memory temporary folder
> > *$IncludeConfig
> > /tmp/syslog/*.conf*
> >
> > Thus
> >
> > 1. Until my program is not running, There is no conf files inside
> > *$IncludeConfig
> > /tmp/syslog/*.conf * and so rsyslog uses the standard way
> >
> > #### RULES (Not processed when my program is runnning)####
> >
> > # Log all kernel messages to the console.
> > # Logging much else clutters up the screen.
> > #kern.* /dev/console
> >
> > # Log anything (except mail) of level info or higher.
> > # Don't log private authentication messages!
> > *.debug;mail.none;authpriv.none;cron.none /var/log/messages
> >
> > # The authpriv file has restricted access.
> > authpriv.* /var/log/secure
> >
> > # Log all the mail messages in one place.
> > mail.* /var/log/maillog
> >
> > that
> > # Log cron stuff
> > cron.* /var/log/cron
> >
> > # Everybody gets emergency messages
> > *.emerg :omusrmsg:*
> >
> > # Save news errors of level crit and higher in a special file.
> > uucp,news.crit /var/log/spooler
> >
> > # Save boot messages also to boot.log
> > local7.* /var/log/boot.log
> >
> > 2. My program populates *$IncludeConfig /tmp/syslog/ *with several conf
> > files for different targets and facilities. At the end, it creates a file
> > only containing "STOP" command that prevents rsyslog to continue processing
> > the standard rules
> >
> > It's a shame that "STOP is followed by unreachable statements" is an error
> > and not a warning... Thus I could have let my program as it is ;-)...
> >
> > Anyway, I'm opened to change the way I did. Any suggestion would be welcomed
> >
> > Best regards,
> >
> > Thomas
> > _______________________________________________
> > rsyslog mailing list
> > https://lists.adiscon.net/mailman/listinfo/rsyslog
> > http://www.rsyslog.com/professional-services/
> > What's up with rsyslog? Follow https://twitter.com/rgerhards
> > NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.
_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.