teler and custom logs / haproxy #86
-
From: Christian Ruppert <[REDACTED]>
To: <[email protected]>
Date: Fri, 11 Dec 2020 04:27:13 +0700
Subject: teler and custom logs / haproxy
Hey,
I'm just curious, is there a reference for all those log keywords /
variables?
Like how do I configure it to parse HAProxy logs?
https://cbonte.github.io/haproxy-dconv/2.3/configuration.html#8.2.3
The fields described there, from 1 to 16. captured header are listed
within the {} and separated by a |
Example as logged to a syslog-ng including timestamps and host:
Dec 10 22:01:10 localhost haproxy[32214]: someipv4_or_ipv6:client_port
[10/Dec/2020:22:01:10.707] frontend~ backend1/server1 0/0/0/29/29 304
178 - - ---- 5/3/0/0/0 0/0 {example.com|Mozilla/5.0 (Windows NT 10.0;
Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0|} "GET
https://example.com/ HTTP/2.0"
How can I skip some strings? Like the very specific termination states
or just something I don't need?
--
Regards,
Christian Ruppert |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
As we don't have clear documentation on how to define In your case (HAProxy access log), to skip (some of) log string, you also have to specify a variable name for that (will be skipped) string in Your HAProxy access log-line is: Your
log_format: |
$x $x $x $x $x[$x]: $remote_addr:$x [$time_local]
$x $x $x $status $body_bytes_sent $x $x $x $x $x {$x} {$x}
"$request_method $request_uri $request_protocol" If we breakdown it will look like:
The |
Beta Was this translation helpful? Give feedback.
-
Thanks!
Although it seems the $remote_addr doesn't like IPv6. It often reports stuff like Also it's somewhat difficult to read, when you have a global log for multiple (v)hosts. So e.g. |
Beta Was this translation helpful? Give feedback.
As we don't have clear documentation on how to define
log_format
variables for each type of server access log, which is different (related #85). If you refer to my slides (https://dw1.io/files/teler%20-%20Protect%20Your%20WebApp.pdf) on page 30/50, thelog_format
required (to analysis or alerting needs) on teler is correct for all variables of the Nginx server'slog_format
example.In your case (HAProxy access log), to skip (some of) log string, you also have to specify a variable name for that (will be skipped) string in
log_format
(which will not be analyzed by teler because it's not needed). For example:Your HAProxy access log-line is:
Feb 6 12:14:14 localhost haproxy[14389]: 10.0.1.2…