Filters

haproxy.filters.filter_backend(backend_name)

Filter Line objects by the HAProxy backend name they were processed with.

Parameters:backend_name (string) – Name of the HAProxy backend section to investigate.
Returns:a function that filters by the given backend name.
Return type:function
haproxy.filters.filter_frontend(frontend_name)

Filter Line objects by the HAProxy frontend name the connection arrived from.

Parameters:frontend_name (string) – Name of the HAProxy frontend section to investigate.
Returns:a function that filters by the given frontend name.
Return type:function
haproxy.filters.filter_http_method(http_method)

Filter Line objects by their HTTP method used (i.e. GET, POST…).

Parameters:http_method (string) – HTTP method (POST, GET…).
Returns:a function that filters by the given HTTP method.
Return type:function
haproxy.filters.filter_ip(ip)

Filter Line objects by IP.

Parameters:ip (string) – IP that you want to filter to.
Returns:a function that filters by the provided IP.
Return type:function
haproxy.filters.filter_ip_range(ip_range)

Filter Line objects by IP range.

Both 192.168.1.203 and 192.168.1.10 are valid if the provided ip range is 192.168.1 whereas 192.168.2.103 is not valid (note the .2.).

Parameters:ip_range (string) – IP range that you want to filter to.
Returns:a function that filters by the provided IP range.
Return type:function
haproxy.filters.filter_path(path)

Filter Line objects by their request path.

Parameters:path (string) – part of a path that needs to be on the request path.
Returns:a function that filters by the provided path.
Return type:function
haproxy.filters.filter_response_size(size)

Filter Line objects by the response size (in bytes).

Specially useful when looking for big file downloads.

Parameters:size (string) – Minimum amount of bytes a response body weighted.
Returns:a function that filters by the response size.
Return type:function
haproxy.filters.filter_server(server_name)

Filter Line objects by the downstream server that handled the connection.

Parameters:server_name (string) – Name of the server HAProxy send the connection to.
Returns:a function that filters by the given server name.
Return type:function
haproxy.filters.filter_slow_requests(slowness)

Filter Line objects by their response time.

Parameters:slowness (string) – minimum time, in milliseconds, a server needs to answer a request. If the server takes more time than that the log line is accepted.
Returns:a function that filters by the server response time.
Return type:function
haproxy.filters.filter_ssl(ignore=True)

Filter Line objects that from SSL connections.

Parameters:ignore (bool) – parameter to be ignored just to conform to the rule that all filters need a parameter
Returns:a function that filters SSL log lines.
Return type:function
haproxy.filters.filter_status_code(http_status)

Filter Line objects by their HTTP status code.

Parameters:http_status (string) – HTTP status code (200, 404, 502…) to filter lines with.
Returns:a function that filters by HTTP status code.
Return type:function
haproxy.filters.filter_status_code_family(family_number)

Filter Line objects by their family of HTTP status code, i.e. 2xx, 3xx, 4xx

Parameters:family_number (string) – First digit of the HTTP status code family, i.e. 2 to get all the 2xx status codes, 4 for the client errors and so on.
Returns:a function that filters by HTTP status code family.
Return type:function
haproxy.filters.filter_time_frame(start, delta)

Filter Line objects by their connection time.

Parameters:
  • start (string) – a time expression (see -s argument on –help for its format) to filter log lines that are before this time.
  • delta (string) – a relative time expression (see -s argument on –help for its format) to limit the amount of time log lines will be considered.
Returns:

a function that filters by the time a request is made.

Return type:

function

haproxy.filters.filter_wait_on_queues(max_waiting)

Filter Line objects by their queueing time in HAProxy.

Parameters:max_waiting (string) – maximum time, in milliseconds, a request is waiting on HAProxy prior to be delivered to a backend server. If HAProxy takes less than that time the log line is counted.
Returns:a function that filters by HAProxy queueing time.
Return type:function