On Tue, Aug 17, 2010 at 11:33 AM, Willy Tarreau <[email protected]> wrote: > On Tue, Aug 17, 2010 at 11:30:46AM +0200, Alexander Staubo wrote: >> >> No, but a local file definitely would. :-) > > Indeed, but a local file is not compatible with chroot and above all, it > would not permit to be completely asynchronous, meaning that the traffic > would stall when performing writes. The real advantage of the local syslog > is to run in a separate process ;-)
I agree. There is another way, though. You could follow Varnish's example, which in my opinion is an ideal compromise between performance and lossiness, and opens up several extremely useful opportunities for tracing. You may be familiar with it. Varnish logs binary entries to a circular buffer held in shared memory. Each individual session event -- client connect, new header line, backend connect, backend response, and so on -- is logged as a separate log entry. Since it's just a memory write, it's incredibly fast. The varnishlog tool opens the shared memory buffer and reads each entry and displays it. This is useful to get a live stream of events, but you can also run varnishlog as a daemon to log continuously to a file, thereby achieving a similar process division as syslog. Like syslog, Varnish will leak log records if the circular buffer is too small, but unlike the syslog case you can actually fix the problem easily by increasing the buffer size. The other tools that come with Varnish build on the shared memory buffer to render the live log in different ways. For example, varnishhist displays a live histogram [2] of response times, varnishstat [3] displays live metrics (current and aggregated over time), and varnishtop [4] displays the top log records, based on some filter. Varnish reuses the same filter options across all these tools; for example, I can do "varnishlog -i RxURL" to dump all requested URLs to stdout. Or I can use "varnishtop -i RxURL" to continuously show the top URLs over time. It's a fantastic toolset, built around a very simple idea. [1] http://blogs.osuosl.org/gchaix/files/2009/10/varnishlog.png [2] http://img.vivaolinux.com.br/imagens/artigos/comunidade/varnishhist.png [3] http://img.vivaolinux.com.br/imagens/artigos/comunidade/varnishstat.png [4] http://blogs.osuosl.org/gchaix/files/2009/10/varnishtop.png

