Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 4.10
- Ruby:
- Distribution: Ubuntu 14.04 & 18.04
- Module version: 5.0.1
What are you seeing
I'm in the process of replacing our Ubuntu 14.04 servers with 18.04 and want to use this module instead of a legacy one we built many years ago.
I can manage Varnish just fine, but am unable to manage the varnishncsa logging service.
What behaviour did you expect instead
I'd like to be able to manage and configure the varnishncsa service via this module. It is included with Varnish but disabled by default. So that means I'd like to define the logformat it uses via Hiera, as well as ensuring the service is started and running.
How do you currently run varnishncsa, or do you not log Varnish requests at all? Would it be possible to add this functionality to your otherwise excellent module?
I currently define the logformat on Ubuntu 14.04 in /etc/default/varnishncsa (yes, all the backslashes are necessary to get json output). On systemd systems such as 18.04 this should probably be done differently.
VARNISHNCSA_ENABLED=1
LOG_FORMAT="-F{\\\"timestamp\\\": \\\"%{%Y-%m-%dT%T%z}t\\\",\\\"client_ip\\\": \\\"%h\\\",\\\"varnish.bytes_write\\\": %b,\\\"varnish.hit_miss\\\": \\\"%{Varnish:hitmiss}x\\\",\\\"varnish.time_first_byte\\\": %{Varnish:time_firstbyte}x,\\\"varnish.handling\\\": \\\"%{Varnish:handling}x\\\",\\\"varnish.cacheable\\\": \\\"%{X-Cacheable}o\\\",\\\"varnish.response_time_usec\\\": %D,\\\"content_type\\\": \\\"%{Content-Type}o\\\",\\\"x_forwarded_for\\\": \\\"%{X-Forwarded-For}i\\\",\\\"auth\\\": \\\"%u\\\",\\\"status_code\\\": %s,\\\"http.request_full\\\": \\\"%r\\\",\\\"http.request\\\": \\\"%U\\\",\\\"http.querystring\\\": \\\"%q\\\",\\\"http.host\\\": \\\"%{host}i\\\",\\\"http.method\\\": \\\"%m\\\",\\\"http.referrer\\\": \\\"%{Referer}i\\\",\\\"useragent\\\": \\\"%{User-agent}i\\\"}"
This file is sourced by the init script /etc/init.d/varnishncsa and the LOG_FORMAT variable is passed to the daemon.
start_varnishncsa() {
<--snip-->
if start-stop-daemon --start --pidfile ${PIDFILE} \
--chuid $USER --exec ${DAEMON} -- ${DAEMON_OPTS} \
"${LOG_FORMAT}" \
> ${output} 2>&1; then
<--snip-->
Much appreciated!
Affected Puppet, Ruby, OS and module versions/distributions
What are you seeing
I'm in the process of replacing our Ubuntu 14.04 servers with 18.04 and want to use this module instead of a legacy one we built many years ago.
I can manage Varnish just fine, but am unable to manage the varnishncsa logging service.
What behaviour did you expect instead
I'd like to be able to manage and configure the varnishncsa service via this module. It is included with Varnish but disabled by default. So that means I'd like to define the logformat it uses via Hiera, as well as ensuring the service is started and running.
How do you currently run varnishncsa, or do you not log Varnish requests at all? Would it be possible to add this functionality to your otherwise excellent module?
I currently define the logformat on Ubuntu 14.04 in /etc/default/varnishncsa (yes, all the backslashes are necessary to get json output). On systemd systems such as 18.04 this should probably be done differently.
This file is sourced by the init script /etc/init.d/varnishncsa and the LOG_FORMAT variable is passed to the daemon.
Much appreciated!