-
-
Save haproxytechblog/d059021ea00c53f3d4d333b97fb20bd2 to your computer and use it in GitHub Desktop.
Encoding HAProxy logs in machine-readable JSON or CBOR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mode http | |
| log-format "${HAPROXY_HTTP_LOG_FMT}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <134>1 2024-06-20T11:47:56.817934+02:00 - haproxy 266980 - - 127.0.0.1:50516 [20/Jun/2024:11:47:56.766] mybackend mybackend/s1 0/0/24/27/51 404 379 - - ---- 1/1/0/0/0 0/0 "GET /index.html HTTP/1.1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setenv HTTPLOG_JSON "%{+json}o %(client_ip)ci %(client_port)cp %(request_date)tr %(fe_name_transport)ft %(be_name)b %(server_name)s %(time_request)TR %(time_wait)Tw %(time_connect)Tc %(time_response)Tr/%(time_active)Ta %(status_code)ST %(bytes_read)B %(captured_request_cookie)CC %(captured_response_cookie)CS %(termination_state_cookie)tsc %(actconn)ac %(feconn)fc %(beconn)bc %(srv_conn)sc %(retries)rc %(srv_queue)sq %(backend_queue)bq %(captured_request_headers)hr %(captured_response_headers)hs %(http_request){+Q}r" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| log-format "${HTTPLOG_JSON}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <134>1 2024-06-20T15:56:09.259280+02:00 - haproxy 279818 - - {"client_ip": "127.0.0.1", "client_port": "58734", "request_date": "20/Jun/2024:15:56:09.206", "fe_name_transport": "myfront", "be_name": "mybackend", "server_name": "s1", "time_request": 0, "time_wait": 0, "time_connect": 25, "time_response": 27, "time_active": 52, "status_code": 404, "bytes_read": 379, "captured_request_cookie": "", "captured_response_cookie": "", "termination_state_cookie": "----", "actconn": 1, "feconn": 1, "beconn": 0, "srv_conn": 0, "retries": 0, "srv_queue": 0, "backend_queue": 0, "captured_request_headers": null, "captured_response_headers": null, "http_request": "GET /index.html HTTP/1.1"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setenv HTTPLOG_CBOR "%{+cbor}o %(client_ip)ci %(client_port)cp %(request_date)tr %(fe_name_transport)ft %(be_name)b %(server_name)s %(time_request)TR %(time_wait)Tw %(time_connect)Tc %(time_response)Tr/%(time_active)Ta %(status_code)ST %(bytes_read)B %(captured_request_cookie)CC %(captured_response_cookie)CS %(termination_state_cookie)tsc %(actconn)ac %(feconn)fc %(beconn)bc %(srv_conn)sc %(retries)rc %(srv_queue)sq %(backend_queue)bq %(captured_request_headers)hr %(captured_response_headers)hs %(http_request){+Q}r" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| log-format "${HTTPLOG_CBOR}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <134>1 2024-06-20T16:00:56.444019+02:00 - haproxy 280387 - - BF69636C69656E745F6970693132372E302E302E316B636C69656E745F706F7274198C346C726571756573745F64617465781832302F4A756E2F323032343A31363A30303A35362E3339337166655F6E616D655F7472616E73706F72747F676D7966726F6E74FF6762655F6E616D65676D7966726F6E746B7365727665725F6E616D656273316C74696D655F72657175657374006974696D655F77616974006C74696D655F636F6E6E656374166D74696D655F726573706F6E7365181B6B74696D655F61637469766518316B7374617475735F636F64651901946A62797465735F7265616419017B7763617074757265645F726571756573745F636F6F6B6965F6781863617074757265645F726573706F6E73655F636F6F6B6965F678187465726D696E6174696F6E5F73746174655F636F6F6B6965642D2D2D2D67616374636F6E6E01666665636F6E6E01666265636F6E6E00687372765F636F6E6E00677265747269657300697372765F7175657565006D6261636B656E645F717565756500781863617074757265645F726571756573745F68656164657273F6781963617074757265645F726573706F6E73655F68656164657273F66C687474705F726571756573747F7818474554202F696E6465782E68746D6C20485454502F312E31FFFF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment