Skip to content

Instantly share code, notes, and snippets.

@alq666
Created June 21, 2012 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alq666/2968655 to your computer and use it in GitHub Desktop.
Save alq666/2968655 to your computer and use it in GitHub Desktop.
Simple haproxy parser
# 2012-06-21T06:49:34+00:00 localhost haproxy[14561]: 10.193.171.146:8047 [21/Jun/2012:06:49:34.002] public dogdispatcher/i-6529e303:9000 52/0/2/10/64 202 151 - - ---- 583/570/3/
# $4 source
# $7 backend/host:port
# $8 Tq/.../Tr/Tt
BEGIN {
}
{
# parse urls
split($(NF-1), p, "?");
url = p[1];
req[url] = 1;
# compute timings
split($8, t, "/");
tq = t[1];
tr = t[4];
tt = t[5];
# source
split($4, s, ":");
host = s[1];
# dest
split($7, d, "/");
dest = d[2];
printf("%s,%s,%d,%d,%d,%s\n", host, dest, tq, tr, tt, url);
}
END {
}
@alq666
Copy link
Author

alq666 commented Jun 3, 2013

@miketheman dog metric post

dd.haproxy.response_codes_per_hour

tagged by code:xyz, submitted as a gauge

@miketheman
Copy link

Since it's going to be run from cron, and there's no existing .dogrc, and there are multiple metrics, I am considering wrapping this in a python executable.
https://gist.github.com/miketheman/5700963

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment