Ema has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/323829

Change subject: varnish: make python varnish scripts skip PURGE requests
......................................................................

varnish: make python varnish scripts skip PURGE requests

Add VSL queries to filter out PURGE requests where it makes sense.

Bug: T151643
Change-Id: I9f242b57ea092bfbf04016b3a3c675aca4aefeb4
---
M modules/varnish/files/varnishmedia
M modules/varnish/files/varnishrls
M modules/varnish/files/varnishstatsd
M modules/varnish/files/varnishxcache
M modules/varnish/files/varnishxcps
5 files changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/29/323829/1

diff --git a/modules/varnish/files/varnishmedia 
b/modules/varnish/files/varnishmedia
index 27a0535..89728b0 100755
--- a/modules/varnish/files/varnishmedia
+++ b/modules/varnish/files/varnishmedia
@@ -56,11 +56,12 @@
 
     def start(self):
         varnishlog.varnishlog((
-            ('q', 'ReqURL ~ "/thumb/"'), # Only look at thumb requests
-            ('n', 'frontend'),           # Only frontend Varnish instance
-            ('i', 'RespStatus'),         # RespStatus for the HTTP status code
-            ('i', 'ReqURL'),             # ReqURL to delimit requests
-            ('i', 'Timestamp'),          # Timestamp to delimit requests
+            ('q', 'ReqMethod ne "PURGE"'),  # Skip PURGE requests
+            ('q', 'ReqURL ~ "/thumb/"'),    # Only look at thumb requests
+            ('n', 'frontend'),              # Only frontend Varnish instance
+            ('i', 'RespStatus'),            # RespStatus for the HTTP status 
code
+            ('i', 'ReqURL'),                # ReqURL to delimit requests
+            ('i', 'Timestamp'),             # Timestamp to delimit requests
         ), self.handle_log_record)
 
 lp = MediaVarnishLogProcessor()
diff --git a/modules/varnish/files/varnishrls b/modules/varnish/files/varnishrls
index 6949546..cfaf5a1 100755
--- a/modules/varnish/files/varnishrls
+++ b/modules/varnish/files/varnishrls
@@ -65,7 +65,7 @@
 
     def start(self):
         # VSL query matching ResourceLoader ReqURLs
-        query = 'ReqURL ~ "^/w/load.php"'
+        query = 'ReqURL ~ "^/w/load.php" and ReqMethod ne "PURGE"'
 
         varnishlog.varnishlog((
             ('q', query),         # VSL query
diff --git a/modules/varnish/files/varnishstatsd 
b/modules/varnish/files/varnishstatsd
index 9a0089b..41965a2 100755
--- a/modules/varnish/files/varnishstatsd
+++ b/modules/varnish/files/varnishstatsd
@@ -46,6 +46,8 @@
 UDP_MTU_BYTES = 1472
 
 vsl_args = [
+    # Skip PURGE requests
+    ('q', 'ReqMethod ne "PURGE"'),
     # Backend HTTP response status code (eg: 200, 404)
     ('i', 'BerespStatus'),
     # Backend HTTP request method (eg: GET, POST)
diff --git a/modules/varnish/files/varnishxcache 
b/modules/varnish/files/varnishxcache
index c2b3ec3..ebbcead 100755
--- a/modules/varnish/files/varnishxcache
+++ b/modules/varnish/files/varnishxcache
@@ -120,6 +120,7 @@
 
 
 varnishlog.varnishlog((
+    ('q', 'ReqMethod ne "PURGE"'),
     ('I', 'RespHeader:^X-Cache:'),
     ('n', 'frontend'),
 ), vsl_callback)
diff --git a/modules/varnish/files/varnishxcps 
b/modules/varnish/files/varnishxcps
index 73ddf8d..13289da 100755
--- a/modules/varnish/files/varnishxcps
+++ b/modules/varnish/files/varnishxcps
@@ -97,6 +97,7 @@
 vsl_callback.next_pub = time.time() + args.interval
 
 varnishlog.varnishlog((
+    ('q', 'ReqMethod ne "PURGE"'),
     ('I', 'ReqHeader:^X-Connection-Properties:'),
     ('n', 'frontend'),
 ), vsl_callback)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f242b57ea092bfbf04016b3a3c675aca4aefeb4
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