Skip to content

Instantly share code, notes, and snippets.

@dkorunic
Created October 14, 2022 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkorunic/e8c71609881678e78d5c976768133c4f to your computer and use it in GitHub Desktop.
Save dkorunic/e8c71609881678e78d5c976768133c4f to your computer and use it in GitHub Desktop.
HAProxy access logs rulebase for rsyslog
version=2
type=@request_time:[%day:char-to:/%/%mon:char-to:/%/%year:number%:%time:time-24hr% %zone:char-to:]%]
rule=:%-:alternative{"parser":[{"type":"ipv4","name":"client_ip"},{"type":"ipv6","name":"client_ip"}]}% - - %request_time:@request_time% "%request_method:word% %request_uri:word% %request_version:char-to:"%" %response_code:float{"format":"string"}% %-:alternative{"parser":[{"type":"literal","text":"+","name":"logasap"},{"type":"literal","text":""}]}%%response_bytes:float{"format":"string"}% "" "" %-:alternative{"parser":[{"type":"float","format":"string","name":"client_port"},{"type":"word"}]}% %accept_ms:number{"format":"string"}% "%frontend_name:char-to:"%" "%backend_name:char-to:"%" "%server_name:char-to:"%" %timer_TR:float{"format":"string"}% %timer_Tw:float{"format":"string"}% %timer_Tc:float{"format":"string"}% %timer_Tr:float{"format":"string"}% %timer_Ta:float{"format":"string"}% %termination_state:word% %active_conn:float{"format":"string"}% %frontend_conn:float{"format":"string"}% %backend_conn:float{"format":"string"}% %server_conn:number{"format":"string"}% %-:alternative{"parser":[{"type":"literal","text":"+","name":"redispatch"},{"type":"literal","text":""}]}%%retries:float{"format":"string"}% %server_queue:float{"format":"string"}% %backend_queue:float{"format":"string"}% %-:rest%
#
rule=:%-:alternative{"parser":[{"type":"ipv4","name":"client_ip"},{"type":"ipv6","name":"client_ip"}]}% - - %request_time:@request_time% "%request_method:word% %request_uri:char-to:"%" %response_code:float{"format":"string"}% %-:alternative{"parser":[{"type":"literal","text":"+","name":"logasap"},{"type":"literal","text":""}]}%%response_bytes:float{"format":"string"}% "" "" %-:alternative{"parser":[{"type":"float","format":"string","name":"client_port"},{"type":"word"}]}% %accept_ms:number{"format":"string"}% "%frontend_name:char-to:"%" "%backend_name:char-to:"%" "%server_name:char-to:"%" %timer_TR:float{"format":"string"}% %timer_Tw:float{"format":"string"}% %timer_Tc:float{"format":"string"}% %timer_Tr:float{"format":"string"}% %timer_Ta:float{"format":"string"}% %termination_state:word% %active_conn:float{"format":"string"}% %frontend_conn:float{"format":"string"}% %backend_conn:float{"format":"string"}% %server_conn:number{"format":"string"}% %-:alternative{"parser":[{"type":"literal","text":"+","name":"redispatch"},{"type":"literal","text":""}]}%%retries:float{"format":"string"}% %server_queue:float{"format":"string"}% %backend_queue:float{"format":"string"}% %-:rest%
#
rule=:%-:alternative{"parser":[{"type":"ipv4","name":"client_ip"},{"type":"ipv6","name":"client_ip"}]}% - - %request_time:@request_time% "%request_uri:char-to:"%" %response_code:float{"format":"string"}% %-:alternative{"parser":[{"type":"literal","text":"+","name":"logasap"},{"type":"literal","text":""}]}%%response_bytes:float{"format":"string"}% "" "" %-:alternative{"parser":[{"type":"float","format":"string","name":"client_port"},{"type":"word"}]}% %accept_ms:number{"format":"string"}% "%frontend_name:char-to:"%" "%backend_name:char-to:"%" "%server_name:char-to:"%" %timer_TR:float{"format":"string"}% %timer_Tw:float{"format":"string"}% %timer_Tc:float{"format":"string"}% %timer_Tr:float{"format":"string"}% %timer_Ta:float{"format":"string"}% %termination_state:word% %active_conn:float{"format":"string"}% %frontend_conn:float{"format":"string"}% %backend_conn:float{"format":"string"}% %server_conn:number{"format":"string"}% %-:alternative{"parser":[{"type":"literal","text":"+","name":"redispatch"},{"type":"literal","text":""}]}%%retries:float{"format":"string"}% %server_queue:float{"format":"string"}% %backend_queue:float{"format":"string"}% %-:rest%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment