systemd Piping varnishncsa Output

Nigel Peck np.lists at sharphosting.uk
Fri Apr 7 08:21:17 CEST 2017


Hi,

I'm trying to pipe the output from varnishncsa when running through systemd on CentOS 7 and having a lot of trouble. I read through every relevant post in the archives and search for hours on Google but haven't solved it yet.

I'm trying to pipe to cronolog. The only thing I've got to work takes over the foreground, and nothing I've tried for running it in the background works. How can I set up varnishncsa.service so that output is piped to a program instead of written to a file? Should I still run varnishncsa with -D or not? If not how does the PID get written so it can be stopped again by systemctl?

I got it to work while taking over the foreground with this script:

#!/bin/bash
/usr/bin/varnishncsa -F '%{X-Real-IP}i %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"' -q "ReqHeader:Host ~ '
(^|\.)example\.com$'" -C |/usr/sbin/cronolog "/example/varnish_access_log
.%Y-%m-%d"

Any assistance greatly appreciated.

Thanks
Nigel



More information about the varnish-misc mailing list