Puppet Class: varnish::dispatch_log

Defined in:
manifests/dispatch_log.pp

Overview

Class varnish::dispatch_log

Installs dispatch-log script and set its service

Dispatch-log is a perl script which will take varnishncsa output as input and dispatch log according to vhosts. It requires a configuration file which will contain :

  • $LOGDIR: base log dir. (optional, default: /mnt/varnish)

  • $pid_file: pid file (optional, default /var/run/dispatch-log.pid)

  • a perl hashmap named “%groups” like this:

$groups‘vhost’ = ‘subdirectory’;

Warning! you cannot change $LOGDIR nor $pid_file without restarting the service

Requires:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'manifests/dispatch_log.pp', line 20

class varnish::dispatch_log {

  $module_path = get_module_path($module_name)

  file {'/usr/local/bin/dispatch-log':
    ensure  => file,
    mode    => '0755',
    group   => root,
    owner   => root,
    content => file("${module_path}/files/usr/local/bin/dispatch-log"),
  }

  file {'/etc/init.d/dispatch-log':
    ensure  => file,
    mode    => '0755',
    group   => root,
    owner   => root,
    content => file("${module_path}/files/etc/init.d/dispatch-log"),
  }

  service { 'dispatch-log':
    ensure  => 'running',
    enable  => true,
    pattern => 'bin/dispatch-log',
    require => [ Class['varnish'], File['/etc/init.d/dispatch-log'], File['/usr/local/bin/dispatch-log'] ],
  }

}