On 24/02/16 00:28, Brian Brazil wrote:
> On 24 February 2016 at 00:20, Christopher Baines <
ma...@cbaines.net
> > <mailto:
ma...@cbaines.net <mailto:
ma...@cbaines.net>>> wrote:
> >
> > I am in the progress of writing an exporter for HAProxy logs [1]. Its
> > now working ok for me, so I'm publishing it in case anyone else is
> > interested in experimenting.
> >
> > 1:
http://git.cbaines.net/prometheus-haproxy-log-exporter/
> >
> >
> > Have you looked at
https://github.com/google/mtail which already has
> > Prometheus support and can handle logs generally?
>
> No I have not, I looked around for anything doing log processing, but
> did not come across mtail. It looks interesting, although it does not
> look possible to export histograms (yet).
>
> > There's also
https://github.com/prometheus/haproxy_exporter for the
> > stats that haproxy itself exposes.
>
> I am using that currently, and I think both exporters are very useful
> and complementary. The haproxy exporter is very useful for gathering
> overall stats, and the haproxy log exporter is very useful at gathering
> metrics relating to individual requests.
>
>
> If you're interested in individual requests, then you probably shouldn't
> be looking to get that data into Prometheus as it's a metrics store
> rather than a log store. Something like the ELK stack or graylog is
> likely more what you're looking for.
> See
https://blog.raintank.io/logs-and-metrics-and-graphs-oh-my/
Maybe metrics relating to individual requests is not the right way of
putting it, but as per the example metrics I gave below, I am using
counters and histograms labeled with information contained in the log
lines (e.g. http_request_path, server_queue, ...) to build metrics (I am
not storing the log lines in Prometheus, just metrics).
I have made guesses at default bucket values [1], although now that you
mention it, it might be better to transform the unit of the data
(haproxy timers are in milliseconds, not seconds) rather than transform
the default bucket sizes (which I currently do).
1:
http://git.cbaines.net/prometheus-haproxy-log-exporter/tree/prometheus_haproxy_log_exporter/metrics.py#n79