Ema has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/390258 )

Change subject: WIP: varnish: log slow requests
......................................................................

WIP: varnish: log slow requests

Change-Id: Icb39030c74566cb8bbf7f6440951f3d223f39c62
---
M modules/varnish/manifests/instance.pp
A modules/varnish/templates/initscripts/varnish-slowreqs.systemd.erb
2 files changed, 31 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/58/390258/1

diff --git a/modules/varnish/manifests/instance.pp 
b/modules/varnish/manifests/instance.pp
index 1d615c8..13cfeda 100644
--- a/modules/varnish/manifests/instance.pp
+++ b/modules/varnish/manifests/instance.pp
@@ -168,6 +168,20 @@
         },
     }
 
+    # Log slow requests to syslog
+
+    $slow_req_threshold = '10.0' # XXX: somewhere in hiera?
+
+    systemd::service { "varnish${instancesuffix}-slowreqs":
+        ensure         => present,
+        content        => systemd_template('varnish-slowreqs'),
+        restart        => true,
+        service_params => {
+            require => Service["varnish${instancesuffix}"],
+            enable  => true,
+        },
+    }
+
     # This mechanism with the touch/rm conditionals in the pair of execs
     #   below should ensure that reload-vcl failures are retried on
     #   future puppet runs until they succeed.
diff --git a/modules/varnish/templates/initscripts/varnish-slowreqs.systemd.erb 
b/modules/varnish/templates/initscripts/varnish-slowreqs.systemd.erb
new file mode 100644
index 0000000..5160e9f
--- /dev/null
+++ b/modules/varnish/templates/initscripts/varnish-slowreqs.systemd.erb
@@ -0,0 +1,17 @@
+[Unit]
+Description=Varnish <%= @inst %> Slow Requests
+After=varnish<%= @instancesuffix %>.service
+Requires=varnish<%= @instancesuffix %>.service
+
+[Service]
+StandardOutput=syslog
+StandardError=syslog
+SyslogIdentifier=varnish<%= @instancesuffix %>-slowreqs
+Restart=always
+# Note the usage of the %% specifier here.
+# See systemd.unit(5), section SPECIFIERS.
+ExecStart=/usr/bin/varnishncsa <%= @extraopts %> -q 'ReqMethod ne "PURGE" and 
Timestamp:Resp[2] > <%= @slow_req_threshold %>' -F '%{VSL:Timestamp:Resp}x %%r 
%%s'
+
+[Install]
+WantedBy=multi-user.target
+

-- 
To view, visit https://gerrit.wikimedia.org/r/390258
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb39030c74566cb8bbf7f6440951f3d223f39c62
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema <e...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to