{"id":229,"date":"2015-03-11T21:50:08","date_gmt":"2015-03-12T03:50:08","guid":{"rendered":"https:\/\/www.jumpcloud.com\/engineering-blog\/?p=229"},"modified":"2021-10-08T13:21:27","modified_gmt":"2021-10-08T17:21:27","slug":"custom-logging-per-backend-in-haproxy","status":"publish","type":"post","link":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy","title":{"rendered":"Custom logging per backend in HAProxy"},"content":{"rendered":"\n

HAProxy has good configurable logging.<\/p>\n\n\n\n

I have a proxy with two backends, routed differently based on the port they’re using.<\/p>\n\n\n\n

#———————————————————————\n# http frontend\n#———————————————————————\nfrontend http_frontend\n    bind *:444\n    default_backend http_backend\n\n#———————————————————————\n# nssocket frontend\n#———————————————————————\nfrontend nssocket_frontend\n    bind *:443\n    default_backend nssocket_backend\n<\/pre>\n\n\n\n

The issue is that ‘nssocket’ traffic is way higher than the http traffic. It’s also less useful information to me, since I care about that traffic less. I’d like to have it be less verbose in my logs, but still sensitive enough to let me know if there’s trouble.<\/p>\n\n\n\n

nssocket_frontend nssocket_backend\/as11 1\/0\/15 1244 — 638\/4\/4\/1\/0 0\/0\nhttp_frontend http_backend\/as8 1\/0\/5310 1261 — 639\/633\/633\/123\/0 0\/0\nnssocket_frontend nssocket_backend\/as8 1\/0\/142 1244 — 638\/5\/5\/1\/0 0\/0\nnssocket_frontend nssocket_backend\/as11 1\/0\/12 1244 — 637\/4\/4\/1\/0 0\/0\nnssocket_frontend nssocket_backend\/as11 1\/0\/13 1244 — 637\/4\/4\/1\/0 0\/0\nnssocket_frontend nssocket_backend\/as11 1\/0\/168 1244 — 637\/4\/4\/1\/0 0\/0\nnssocket_frontend nssocket_backend\/as11 1\/0\/12 1244 — 636\/3\/3\/0\/0 0\/0\nnssocket_frontend nssocket_backend\/as11 1\/0\/14 1244 — 638\/5\/5\/1\/0 0\/0\nnssocket_frontend nssocket_backend\/as8 1\/0\/163 1244 — 640\/7\/7\/1\/0 0\/0\nnssocket_frontend nssocket_backend\/as11 1\/0\/16 1244 — 639\/6\/6\/2\/0 0\/0\nnssocket_frontend nssocket_backend\/as11 1\/0\/14 1244 — 640\/7\/7\/3\/0 0\/0\n<\/pre>\n\n\n\n

Basically, I want different logging in HAProxy based on the frontend. The noisy nssocket is just distracting.<\/p>\n\n\n\n

Right now, all logging is being defined via the ‘global’ setting.<\/p>\n\n\n\n

global\n     log         127.0.0.1 local2 debug\n<\/pre>\n\n\n\n

To make this HAProxy logging discriminate per frontend, I override the log settings in each frontend section.<\/p>\n\n\n\n

#———————————————————————\n# http frontend\n#———————————————————————\nfrontend http_frontend\n    bind            *:444\n    default_backend http_backend\n    log             127.0.0.1 local2 debug\n\n#———————————————————————\n# nssocket frontend\n#———————————————————————\nfrontend nssocket_frontend\n    bind            *:443\n    default_backend nssocket_backend\n    log             127.0.0.1 local2 warning\n<\/pre>\n\n\n\n

Now, the logs give me a much more valuable insight into the incoming traffic that I care about, highlighting only the http traffic that matters to me.<\/p>\n\n\n\n

http_frontend http_backend\/as9 1\/0\/1103 1479 — 1893\/1887\/1887\/354\/0 0\/0\nhttp_frontend http_backend\/as12 1\/14\/6256 1261 — 1897\/1891\/1891\/434\/0 0\/0\nhttp_frontend http_backend\/as11 1\/0\/6379 1261 — 1917\/1911\/1911\/351\/0 0\/0\nhttp_frontend http_backend\/as8 1\/0\/6115 1261 — 1918\/1911\/1911\/347\/0 0\/0\nhttp_frontend http_backend\/as11 1\/0\/1297 1479 — 1921\/1914\/1914\/350\/0 0\/0\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

With custom logging per backend in HAProxy, the logs highlight only the valuable http traffic that matters to your organization.<\/p>\n","protected":false},"author":30,"featured_media":232,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_oasis_is_in_workflow":0,"_oasis_original":0,"_oasis_task_priority":"","inline_featured_image":false,"footnotes":""},"categories":[42],"tags":[],"collection":[],"platform":[],"funnel_stage":[3014],"coauthors":[],"acf":[],"yoast_head":"\nCustom logging per backend in HAProxy - JumpCloud<\/title>\n<meta name=\"description\" content=\"Learn how to highlight only the valuable http traffic that matters to your organization using custom logging per backend in HAProxy.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom logging per backend in HAProxy\" \/>\n<meta property=\"og:description\" content=\"Learn how to highlight only the valuable http traffic that matters to your organization using custom logging per backend in HAProxy.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy\" \/>\n<meta property=\"og:site_name\" content=\"JumpCloud\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-12T03:50:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-08T17:21:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1\" \/>\n\t<meta property=\"og:image:height\" content=\"1\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Greg Keller\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Greg Keller\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#article\",\"isPartOf\":{\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy\"},\"author\":{\"name\":\"Greg Keller\",\"@id\":\"https:\/\/jumpcloud.com\/#\/schema\/person\/33bf05bce1792138e1fac8878933c1f6\"},\"headline\":\"Custom logging per backend in HAProxy\",\"datePublished\":\"2015-03-12T03:50:08+00:00\",\"dateModified\":\"2021-10-08T17:21:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy\"},\"wordCount\":151,\"publisher\":{\"@id\":\"https:\/\/jumpcloud.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#primaryimage\"},\"thumbnailUrl\":\"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png\",\"articleSection\":[\"News\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy\",\"url\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy\",\"name\":\"Custom logging per backend in HAProxy - JumpCloud\",\"isPartOf\":{\"@id\":\"https:\/\/jumpcloud.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#primaryimage\"},\"image\":{\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#primaryimage\"},\"thumbnailUrl\":\"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png\",\"datePublished\":\"2015-03-12T03:50:08+00:00\",\"dateModified\":\"2021-10-08T17:21:27+00:00\",\"description\":\"Learn how to highlight only the valuable http traffic that matters to your organization using custom logging per backend in HAProxy.\",\"breadcrumb\":{\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#primaryimage\",\"url\":\"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png\",\"contentUrl\":\"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png\",\"caption\":\"Custom logging HAProxy\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jumpcloud.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Custom logging per backend in HAProxy\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jumpcloud.com\/#website\",\"url\":\"https:\/\/jumpcloud.com\/\",\"name\":\"JumpCloud\",\"description\":\"Daily insights on directory services, IAM, LDAP, identity security, SSO, system management (Mac, Windows, Linux), networking, and the cloud.\",\"publisher\":{\"@id\":\"https:\/\/jumpcloud.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jumpcloud.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jumpcloud.com\/#organization\",\"name\":\"JumpCloud\",\"url\":\"https:\/\/jumpcloud.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jumpcloud.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jumpcloud.com\/wp-content\/uploads\/2021\/01\/jc-logo-brand-2021.png\",\"contentUrl\":\"https:\/\/jumpcloud.com\/wp-content\/uploads\/2021\/01\/jc-logo-brand-2021.png\",\"width\":598,\"height\":101,\"caption\":\"JumpCloud\"},\"image\":{\"@id\":\"https:\/\/jumpcloud.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jumpcloud.com\/#\/schema\/person\/33bf05bce1792138e1fac8878933c1f6\",\"name\":\"Greg Keller\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jumpcloud.com\/#\/schema\/person\/image\/bb829f9c68b309c7d66b61d4436f8afa\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1329dd1fe0f66c8a37039a19f3169d11?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1329dd1fe0f66c8a37039a19f3169d11?s=96&d=mm&r=g\",\"caption\":\"Greg Keller\"},\"description\":\"JumpCloud CTO, Greg Keller is a career product visionary and executive management leader. With over two decades of product management, product marketing, and operations experience ranging from startups to global organizations, Greg excels in successful go-to-market execution.\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Custom logging per backend in HAProxy - JumpCloud","description":"Learn how to highlight only the valuable http traffic that matters to your organization using custom logging per backend in HAProxy.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy","og_locale":"en_US","og_type":"article","og_title":"Custom logging per backend in HAProxy","og_description":"Learn how to highlight only the valuable http traffic that matters to your organization using custom logging per backend in HAProxy.","og_url":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy","og_site_name":"JumpCloud","article_published_time":"2015-03-12T03:50:08+00:00","article_modified_time":"2021-10-08T17:21:27+00:00","og_image":[{"url":"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png","width":1,"height":1,"type":"image\/png"}],"author":"Greg Keller","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Greg Keller","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#article","isPartOf":{"@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy"},"author":{"name":"Greg Keller","@id":"https:\/\/jumpcloud.com\/#\/schema\/person\/33bf05bce1792138e1fac8878933c1f6"},"headline":"Custom logging per backend in HAProxy","datePublished":"2015-03-12T03:50:08+00:00","dateModified":"2021-10-08T17:21:27+00:00","mainEntityOfPage":{"@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy"},"wordCount":151,"publisher":{"@id":"https:\/\/jumpcloud.com\/#organization"},"image":{"@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#primaryimage"},"thumbnailUrl":"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png","articleSection":["News"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy","url":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy","name":"Custom logging per backend in HAProxy - JumpCloud","isPartOf":{"@id":"https:\/\/jumpcloud.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#primaryimage"},"image":{"@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#primaryimage"},"thumbnailUrl":"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png","datePublished":"2015-03-12T03:50:08+00:00","dateModified":"2021-10-08T17:21:27+00:00","description":"Learn how to highlight only the valuable http traffic that matters to your organization using custom logging per backend in HAProxy.","breadcrumb":{"@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#primaryimage","url":"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png","contentUrl":"https:\/\/jumpcloud.com\/wp-content\/uploads\/2015\/03\/Custom-logging-HAProxy-1.png","caption":"Custom logging HAProxy"},{"@type":"BreadcrumbList","@id":"https:\/\/jumpcloud.com\/blog\/custom-logging-per-backend-in-haproxy#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jumpcloud.com\/"},{"@type":"ListItem","position":2,"name":"Custom logging per backend in HAProxy"}]},{"@type":"WebSite","@id":"https:\/\/jumpcloud.com\/#website","url":"https:\/\/jumpcloud.com\/","name":"JumpCloud","description":"Daily insights on directory services, IAM, LDAP, identity security, SSO, system management (Mac, Windows, Linux), networking, and the cloud.","publisher":{"@id":"https:\/\/jumpcloud.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jumpcloud.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jumpcloud.com\/#organization","name":"JumpCloud","url":"https:\/\/jumpcloud.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jumpcloud.com\/#\/schema\/logo\/image\/","url":"https:\/\/jumpcloud.com\/wp-content\/uploads\/2021\/01\/jc-logo-brand-2021.png","contentUrl":"https:\/\/jumpcloud.com\/wp-content\/uploads\/2021\/01\/jc-logo-brand-2021.png","width":598,"height":101,"caption":"JumpCloud"},"image":{"@id":"https:\/\/jumpcloud.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jumpcloud.com\/#\/schema\/person\/33bf05bce1792138e1fac8878933c1f6","name":"Greg Keller","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jumpcloud.com\/#\/schema\/person\/image\/bb829f9c68b309c7d66b61d4436f8afa","url":"https:\/\/secure.gravatar.com\/avatar\/1329dd1fe0f66c8a37039a19f3169d11?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1329dd1fe0f66c8a37039a19f3169d11?s=96&d=mm&r=g","caption":"Greg Keller"},"description":"JumpCloud CTO, Greg Keller is a career product visionary and executive management leader. With over two decades of product management, product marketing, and operations experience ranging from startups to global organizations, Greg excels in successful go-to-market execution."}]}},"_links":{"self":[{"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/posts\/229"}],"collection":[{"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/comments?post=229"}],"version-history":[{"count":3,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/posts\/229\/revisions"}],"predecessor-version":[{"id":39921,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/posts\/229\/revisions\/39921"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/media\/232"}],"wp:attachment":[{"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/media?parent=229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/categories?post=229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/tags?post=229"},{"taxonomy":"collection","embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/collection?post=229"},{"taxonomy":"platform","embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/platform?post=229"},{"taxonomy":"funnel_stage","embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/funnel_stage?post=229"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/coauthors?post=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}