7 ms·
Nginx 1.7.1 adds syslog support
- kolev 12y agoHere's also the error_log: http://nginx.org/en/docs/ngx_core_module.html#error_log http://nginx.org/en/docs/ngx_core_module.html#error_log And the changelog: http://nginx.org/en/CHANGES http://nginx.org/en/CHANGES
- staunch 12y agoThey had to add a checkbox to http://nginx.com/products/feature-matrix/ http://nginx.com/products/feature-matrix/
- akurilin 12y agoWhy is logging to syslog as opposed to a separate file an important use case? Genuinely curious.
- loadquo 12y agoIn short remote syslog-ing.
- quonn 12y agoIt'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.
- nrr 12y agoThat'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.
- bradleyfalzon 12y agoJust FYI rsyslog (available in RHEL/CentOS 6.x) has tcp support.
- danudey 12y ago> 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.
- lobster_johnson 12y agoIn 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 http://www.rsyslog.com/doc/omrelp.html
- IgorPartola 12y ago
- cones688 12y agoAlso allows you to correlate them with backend services, Web App Firewalls etc to see if there is an current attacks or threats.
- gmjosack 12y agoThe 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.
- chrisbolt 12y agosyslog -> logstash -> elasticsearch -> kibana
- rahilsondhi 12y agoCan I reach you privately? I need help with my ELK set up :/
- artbikes 12y agoYou can usually get excellent support on the Logstash IRC channel. #logstash on irc.freenode.org
- rahilsondhi 12y agoThanks, I'll try that.
- WatchDog 12y agoI think one reason people wanted it was to reduce/eliminate disk IO.
- frankzinger 12y agoYeah, and then you can also optimise the logging server's secondary storage setup for mostly appending writes. Or so I hear.
- forgottenpass 12y agoThe 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.
- peterwwillis 12y agoThis 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.
- worklogin 12y agoMy 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.
- mfjordvald 12y agoEspecially considering that it's been available as a community patch since 0.8 days. http://wiki.nginx.org/3rdPartyModules#Third_party_patches http://wiki.nginx.org/3rdPartyModules#Third_party_patches
- kolev 12y agoTrue, it's been available, but having it in the core means that it will get into Linux distros, i.e. people don't have to compile.
- nailer 12y agoDistros have been patching things like this for a long time.
- kolev 12y agoTrue, but I can't recall any having the syslog module out of the box.
- mfjordvald 12y agoYes, I'm saying it's really about time they added it to the core, especially because it's been available as a patch for a long time. I get that they need to differentiate their paid version, I just wish it was in areas where the community hadn't already provided something that works.
- kolev 12y agoI hope they also add cache purge into the community version as well.
- nailer 12y agoAny systemd experts know if there would there be any benefit to supporting journald directly, rather than through the syslog API, on Linux hosts?
- gegenschall 12y agoHave a look at this[0] blogpost. Also, I'm just guessing, once kdbus is in the kernel using direct calls to journald will (or could potentially) be more efficient. [0] http://0pointer.de/blog/projects/journal-submit.html http://0pointer.de/blog/projects/journal-submit.html
- Andys 12y agoHow much buffering does it do, if any? If not sufficient, it can result in either reduced performance or dropped log messages..
- deleted 12y ago[deleted]
- peterwwillis 12y agoWhy would you buffer udp packets?
- ishi 12y agoWhat does Nginx do if the log message is longer than the 1KB limit imposed by the syslog protocol?
- viraptor 12y agoThat's an implementation defined limit in practice. rsyslog for example defaults to 2K (apparently to be compatible with upcoming RFCs), but it's configurable to higher values. If you want to be compatible with other software though, it may need to stay at 1K.
- atmosx 12y agoIt was about time, although I won't make any use of this feature. ps. I always found metalog so much better than syslog.
- livid 12y agoThis is very useful when you need to consolidate error_log from hundreds of Nginx servers.
- napsterbr 12y agoDid someone manage to setup remote log using the buffer option? I get a "parameter "buffer=32k" is not supported by syslog" but I'm pretty sure I'm doing something wrong.
- Thaxll 12y agoFinally... it worked well with logstash but a native implementation is always better. Is that TCP only, I don't see any UDP settings?
- peterwwillis 12y agoIt's UDP only. They also hard-code the port instead of looking it up with getservbyname, which is a little weird. If you want to use TCP, send syslog messages to localhost, and have a local rsyslog/RELP forwarder send messages remotely.
- stonogo 12y agogetservbyname under glibc uses dlopen, effectively working around static compilation. while this is a non-issue on ubuntu, the nginx devs are aware of the number of people building against uclibc or musl to produce static binaries for embedded use. I've seen nginx running on bare metal -- just it and libc, no kernel underneath. kudos to them for making this easier than they have to.
- jesalas 12y agoHooray! Whiny complaining on the Internet works sometimes!