Turning on/off logging for selective environments

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Turning on/off logging for selective environments

Post by stecino »

I have stageA, stageB, prodA, prodB environments where rsyslogd conf files are configured to forward logs to NLS.
What is the easy way to selectively turn off and then may be turn on selective environments or individual servers from forwarding logs to NLS.

I guess one simple way would be removing all the rsyslog conf files, or comment them out, that will forward to NLS. But it could be tidious, unless it's tied to Chef/Puppet.
Is there another way of doing this?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Turning on/off logging for selective environments

Post by Box293 »

Perhaps using the $IncludeConfig directive to reference a directory. This way you can add and delete configs as required, I assume a service restart would be required when this is done.

Here's some reading material:
http://www.rsyslog.com/doc/rsconf1_includeconfig.html
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Turning on/off logging for selective environments

Post by eloyd »

Can you be more specific about what you're trying to do? Is this a one time on/off thing or will you be doing it on a regular basis? Also, why would you want to cease sending logs to NLS when you can just ignore them on the NLS side when pulling reports/dashboards?

NLS installs itself with the "$IncludeConfig /etc/rsyslog.d/*.conf" directive, so that /etc/rsyslog.d files get included. You can programatically turn things on/off there (and we use Chef to do it on our boxes, like you said) but once installed, we never turn them off.

One thought would be to use iptables to dump outbound traffic destined for your NLS server or to use /etc/hosts to redirect outbound traffic from the proper NLS server IP address to someplace else like localhost. This will cause packets to just get dropped, assuming nothing's listen on localhost:5544.

So again, without knowing why you want to do this or what the overall goal is, I would be uncomfortable recommending a specific solution (though I would lean towards iptables dropping outbound packets).
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Turning on/off logging for selective environments

Post by jolson »

stecino,

Please answer the above questions posed by Box293 and eloyd. Thanks!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked