Skip to content

Instantly share code, notes, and snippets.

@darkseed
Forked from sawanoboly/fluentd-source-haproxy.conf
Last active August 29, 2015 14:06
Show Gist options
  • Save darkseed/4d3267764daa71594a6b to your computer and use it in GitHub Desktop.
Save darkseed/4d3267764daa71594a6b to your computer and use it in GitHub Desktop.
<source>
type tail
format /(?<c_ip>[\w\.]+):(?<c_port>\d+) \[(?<a_date>.+)\] (?<f_end>[\w-]+) (?<b_end>[\w-]+)\/(?<b_server>[\w-]+) (?<tw>\d+)\/(?<tc>\d
+)\/(?<tt>\d+) (?<bytes>\d+) (?<t_state>[\w-]+) (?<actconn>\d+)\/(?<feconn>\d+)\/(?<beconn>\d+)\/(?<srv_conn>\d+)\/(?<retries>\d+) (?<
srv_queue>\d+)\/(?<backend_queue>\d+)/
time_format %d/%B/%Y:%H:%M:%S
path /var/log/haproxy/haproxy_access.log
pos_file /opt/fluentd/var/pos/haproxy_access.pos
tag haproxy.access
</source>
template t_haproxy_acc {
template("$MSG\n");
template_escape(no);
};
template t_haproxy_sys {
template("$DATE $HOST $PRIORITY $MSGHDR$MSG\n");
template_escape(no);
};
destination t_haproxy_acc {
file(
"/var/log/haproxy/haproxy_access.log",
template(t_haproxy_acc));
};
destination t_haproxy_sys {
file(
"/var/log/haproxy/haproxy_system.log",
template(t_haproxy_sys));
};
filter f_haproxy_acc {
program(haproxy) and level(info);
};
filter f_haproxy_sys {
program(haproxy) and not level(info);
};
log { source(s_src); filter(f_haproxy_acc); destination(t_haproxy_acc); };
log { source(s_src); filter(f_haproxy_sys); destination(t_haproxy_sys); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment