News for hackers. Stuff that matters.
Re:Nginx 1.7.1 adds syslog support by akurilin on Wednesday May 28, 2014 @03:04AM (#7808765)
Why is logging to syslog as opposed to a separate file an important use case? Genuinely curious.
Re:Nginx 1.7.1 adds syslog support by quonn on Wednesday May 28, 2014 @03:12AM (#7808784)
It's useful if you want to log to a centralized logging server. This helps to have all your logs in one place and also keeps the logs safe, if someone breaks into your server.
Re:Nginx 1.7.1 adds syslog support by nrr on Wednesday May 28, 2014 @07:58AM (#7809451)
That's a pretty weak argument considering that syslog is entirely UDP and is bound to drop log data, sometimes en masse, most likely even silently. Not a good idea.

Why not use something like multilog or svlogd and wire up a tiny processor for it to kick logging data over someplace using something like rsync?

To boot, syslog is annoying to tune, depending on your particular implementation. rsyslog has a default buffer limit of 2k, whereas other syslog implementations (IIRC, syslog-ng and Solaris syslog at the very least) have default buffer limits of 1k, and this might not be obvious until you're running up against that and make the shocking discovery that you're losing data.

On an nginx server that services 2TB/mo worth of transit (which is distinctly possible since I've got infrastructure in production that does this), there's a good chance that you'll be stretching some of these limits a bit.

Re:Nginx 1.7.1 adds syslog support by danudey on Wednesday May 28, 2014 @10:12AM (#7809979)
> That's a pretty weak argument considering that syslog is entirely UDP and is bound to drop log data, sometimes en masse, most likely even silently. Not a good idea.

rsyslog and syslog-ng have support for TCP

> Why not use something like multilog or svlogd

Additional point of failure.

> and wire up a tiny processor for it to kick logging data over someplace using something like rsync?

Additional point of failure (processor); additional point of failure (rsync/ssh); non-realtime log replication (which is bad for breaking/progressive system failure/etc).

> To boot, syslog is annoying to tune, depending on your particular implementation.

All of the examples you list are easier to learn about, tweak, and monitor than the suggestions you've proposed, however.

> On an nginx server that services 2TB/mo worth of transit (which is distinctly possible since I've got infrastructure in production that does this), there's a good chance that you'll be stretching some of these limits a bit.

If you're dealing with 2 TB/mo in transit, you're probably capable enough to understand the risks with centralized log management and mitigate/monitor them ahead of time.

Re:Nginx 1.7.1 adds syslog support by bradleyfalzon on Wednesday May 28, 2014 @08:05AM (#7809477)
Just FYI rsyslog (available in RHEL/CentOS 6.x) has tcp support.
Re:Nginx 1.7.1 adds syslog support by lobster_johnson on Wednesday May 28, 2014 @11:21AM (#7810688)
In addition to what danudey says, modern sysloggers also support Unix domain sockets, which are reliable. Typically this is /dev/log; on Linux, I believe the GNU C Library's syslog() uses this by default.

On Linux, sending UDP to localhost is very reliable and fast, essentially going through kernel buffers with very little overhead. You will only see dropped data if the system is extremely overloaded. I did some testing, a few years back, and was not able to induce packet loss on localhost.

The usual way to set up centralized logging with syslog is to have each node run a local syslog daemon (eg., RSyslog), which then buffers the data and streams it to a central syslog daemon using a more reliable protocol such as RELP [1] over TCP.

[1] http://www.rsyslog.com/doc/omrelp.html

Re:Nginx 1.7.1 adds syslog support by IgorPartola on Wednesday May 28, 2014 @11:44AM (#7810843)
While I agree with you on the whole, one minor point about UDP/datagrams: they are not reliable even on localhost under some circumstances. The point of datagrams is that they are allowed to be lost without a trace if the consumer (syslog) is not consuming fast enough. For example, if process A starts spewing 10,000 log records (UPD or datagram UNIX socket packets) a second at syslog, and syslog can only handle 5,000, then the other 5,000 records will be lost. Any other process will also get its records lost as they will not be guaranteed to be processed. The rate of loss will be controlled by how large a datagram buffer the consumer's kernel has. Moreover, the processing will not be uniform: the buffer is LIFO, so older records will be processed while newer ones will be lost.

On the other hand if you use stream sockets, the producer will either block or be told that the consumer is not ready to read any more data (beauty of TCP). In either case, TCP produces enough overhead compared to UDP to slow down the actual useful part of your application, which is often not desirable.

Neither one of these is a good solution as either your consumer or your producer needs to keep their own very large buffers to accommodate spikes in traffic. Ideally, you do this anyways to ensure that you hold onto all the packets you received.

Having said that, I don't know exactly what rsyslog does so I cannot say if this would actually be a problem for it.

Re:Nginx 1.7.1 adds syslog support by noselasd on Wednesday May 28, 2014 @02:23PM (#7811913)
While it's certainly true that UDP is unreliable even on localhost, unix datagram sockets arn't, they have flow control.
Re:Nginx 1.7.1 adds syslog support by IgorPartola on Thursday May 29, 2014 @04:41AM (#7815327)
I have never seen a reference to this. Can you link a source?
Re:Nginx 1.7.1 adds syslog support by lobster_johnson on Friday May 30, 2014 @09:45PM (#7824956)
AF_UNIX with SOCK_STREAM will behave like TCP, in that a "full" stream will block. See http://stackoverflow.com/questions/1478975/unix-domain-socke..., for example.
Re:Nginx 1.7.1 adds syslog support by cones688 on Wednesday May 28, 2014 @08:00AM (#7809458)
Also allows you to correlate them with backend services, Web App Firewalls etc to see if there is an current attacks or threats.
Re:Nginx 1.7.1 adds syslog support by forgottenpass on Wednesday May 28, 2014 @09:40AM (#7809811)
The use case is people with:

- A large enough deployment to want centralized logging

but are:

- Cheap enough not to buy nginx (for good reason or not)

and

- Too lazy to maintain a patcheset against distro packages

and

- Too bad at linux administration to use the file pipe trick to log to syslog anyway

So, yeah syslog is nice but this change does have quite a narrow use case. What it did have were vocal complainers that knew the right places to complain online to be noticed.

Re:Nginx 1.7.1 adds syslog support by peterwwillis on Wednesday May 28, 2014 @10:23AM (#7810051)
This is kind of a cheap shot at people who just wanted built-in syslog support. There are plenty of reasons someone might not be able to patch or upgrade a binary, and using a fifo is a pretty bad kludge considering the whole thing can hang if they're started/stopped in the wrong order (meaning your startup scripts now have to be rewritten). Building in syslog support means just getting the damn thing working without special hacks and kludges.

But to answer OP's question, syslog is better than just appending to a file because syslog does a lot of things for you, like filtering your logs in real time and splitting them into new files, logging remotely to industry-standard aggregation devices, access control, (somewhat) standardized formatting, log rolling, etc.

Re:Nginx 1.7.1 adds syslog support by worklogin on Wednesday May 28, 2014 @11:09AM (#7810344)
My job as a sysadmin is to keep servers running and log their status and errors.

When a large team has many jobs:

-Yes, I want central logging

-I probably did buy nginx (you're telling me this was already available, but closed source? How rude.)

-No, managing distro patches and writing a web server are not my jobs

-No, I'd prefer avoiding hackish file redirects in lieu of real features, but I'll do what I have to.

Re:Nginx 1.7.1 adds syslog support by gmjosack on Wednesday May 28, 2014 @03:15AM (#7808791)
The simplest answer I could think of is getting remote syslogging for free. This also makes it easier to process nginx logs in realtime without named pipe trickery. I'm pretty excited to clean up some log ingestion code.
Re:Nginx 1.7.1 adds syslog support by WatchDog on Wednesday May 28, 2014 @04:38AM (#7808968)
I think one reason people wanted it was to reduce/eliminate disk IO.
Re:Nginx 1.7.1 adds syslog support by frankzinger on Wednesday May 28, 2014 @05:07AM (#7809027)
Yeah, and then you can also optimise the logging server's secondary storage setup for mostly appending writes. Or so I hear.
Re:Nginx 1.7.1 adds syslog support by chrisbolt on Wednesday May 28, 2014 @03:28AM (#7808831)
syslog -> logstash -> elasticsearch -> kibana
Re:Nginx 1.7.1 adds syslog support by rahilsondhi on Wednesday May 28, 2014 @04:45AM (#7808978)
Can I reach you privately? I need help with my ELK set up :/
Re:Nginx 1.7.1 adds syslog support by artbikes on Wednesday May 28, 2014 @11:41AM (#7810823)
You can usually get excellent support on the Logstash IRC channel. #logstash on irc.freenode.org
Re:Nginx 1.7.1 adds syslog support by rahilsondhi on Wednesday May 28, 2014 @01:48PM (#7811732)
Thanks, I'll try that.
Re:Nginx 1.7.1 adds syslog support by loadquo on Wednesday May 28, 2014 @03:12AM (#7808783)
In short remote syslog-ing.