Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

50%
+0 −0
Q&A How do I prevent remote syslog events from printing locally?

You said rsyslog specifically. Hopefully you are using a version new enough to use the advanced syntax (aka RainerScript). 1 Would something similar to the following work for you? $EscapeControlC...

posted 1y ago by bgstack15‭

Answer
#1: Initial revision by user avatar bgstack15‭ · 2022-12-15T02:02:52Z (over 1 year ago)
You said `rsyslog` specifically. Hopefully you are using a version new enough to use the advanced syntax (aka `RainerScript`). [1]

Would something similar to the following work for you?

    $EscapeControlCharactersOnReceive off
    $template RemoteHost,"/var/log/remote/%HOSTNAME%/application.log"
    if ($hostname != 'localhostnamehere') and ($hostname != 'localhost.fqdn') then ?RemoteHost
    if ($hostname != 'localhostnamehere') and ($hostname != 'localhost.fqdn') then stop

Followed by whatever else you want. This is from something I wrote for myself in 2016 on CentOS 7. I have no idea if the EscapeControlCharactersOnReceive matters for your situation, but it was part of my template back then.

[1]: https://www.rsyslog.com/doc/master/configuration/conf_formats.html