further syslog examples

Joshua Levine jlevine at iwin.com
Wed Sep 15 01:53:16 CEST 2010


Its all hacky, but please note, I have also added:

killall /usr/bin/varnishncsa

To the stop) function of the init script.

Joshua

On 9/14/10 4:43 PM, "Joshua Levine" <jlevine at iwin.com> wrote:

> I wrap it, sending the data to a central syslog-ng for awstats and jawstats
> processing.
> 
> ###
> ### I have edited /etc/init.d/varnish to pipe:
> ###
> /usr/bin/varnishncsa -f -b -P /var/run/varnishncsa-b.pid | /usr/bin/perl -w
> /usr/local/bin/syslog.pl local2 varnish-backend &
> 
> /usr/bin/varnishncsa -f -c -P /var/run/varnishncsa-c.pid | /usr/bin/perl -w
> /usr/local/bin/syslog.pl local2 varnish-client &
> 
> ###
> ### Syslog.pl is very simple:
> ###
> #!/usr/bin/perl -w
> use Sys::Syslog;
> 
> $facility = shift;
> $app = shift;
> 
> openlog($app, 'ndelay', $facility);
> 
> while(<STDIN>) {
>   syslog('info', $_);
>   #  printf($_ . "\n");
> }
> 
> closelog();
> 
> ###
> ### varnish client syslog-ng.conf has
> ###
> source s_varnish_backend {
>        file( "/var/log/varnish/varnishncsa.b.log" follow_freq(1)
> program_override("varnish-backend: "));
> };
> source s_varnish_client {
>        file( "/var/log/varnish/varnishncsa.c.log" follow_freq(1)
> program_override("varnish-client: "));
> };
> 
> 
> ###
> ### central syslog server syslog-ng.conf has per domain processing based
> ### on the client header we set above, and the message body which has the
> ### host/domain data I parse
> ###
> filter f_hostA.domain.com-varnish-client {
>     match(varnish-client value("PROGRAM"))
>     and match(hostA.domain.com value("MESSAGE"))
>     and not match (othercluster.domain.com value("HOST"));
> };
> 
> destination df_hostA.domain.com-varnish-client {
> file("/var/log/varnish/domain.com/hostA.domain.com-varnish-client.log"); };
> log {
>         source(s_remote);
>         filter(f_hostA.domain.com-varnish-client);
>         destination(df_hostA.domain.com-varnish-client);
> };
> 
> Cheers,
> Joshua
> 
> 
> On 9/14/10 3:59 PM, "Joe Williams" <joe at joetify.com> wrote:
> 
>> 
>> I would really like to get varnishlog and/or varnishncsa writing to syslog.
>> Is
>> this possible?
>> 
>> Thanks.
>> -Joe
>> 
>> 
>> On Sep 9, 2010, at 6:46 PM, Joe Williams wrote:
>> 
>>> 
>>> Anyone have examples beyond what's on the wiki of logging varnish to syslog?
>>> 
>>> Thanks.
>>> 
>>> -Joe
>>> 
>>> 
>>> 
>>> Name: Joseph A. Williams
>>> Email: joe at joetify.com
>>> Blog: http://www.joeandmotorboat.com/
>>> Twitter: http://twitter.com/williamsjoe
>>> 
>>> 
>>> _______________________________________________
>>> varnish-misc mailing list
>>> varnish-misc at varnish-cache.org
>>> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
>> 
>> Name: Joseph A. Williams
>> Email: joe at joetify.com
>> Blog: http://www.joeandmotorboat.com/
>> Twitter: http://twitter.com/williamsjoe
>> 
>> 
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at varnish-cache.org
>> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
> 
> 
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc





More information about the varnish-misc mailing list