AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / server / Perguntas / 1004671
Accepted
olivierg
olivierg
Asked: 2020-02-27 05:24:54 +0800 CST2020-02-27 05:24:54 +0800 CST 2020-02-27 05:24:54 +0800 CST

HAProxy registrando o tráfego TCP no syslog

  • 772

Estou tentando configurar meu HAProxy para registrar mais informações do que apenas dizer "proxy backend_xx iniciado" e parece que não estou entendendo como isso funciona.

meu HAProxy é um LB TCP puro (apenas encaminha solicitações do frontend para backends, L4 puro).

eu gostaria de ter os logs mencionados na documentação do HAProxy aqui https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#8.2.2

aqui está minha configuração e problemas no momento, nas "seções globais/padrão", eu tenho:

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    daemon
    user                haproxy
    group               haproxy
    log                 /dev/log local6 debug
    maxconn             50000
    chroot              /var/lib/haproxy
    pidfile             /var/run/haproxy.pid

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                 tcp
    option               tcplog
    log                  global
    option               dontlognull
    timeout connect      5000
    timeout client       50000
    timeout server       50000

eu também tenho essa opção no meu frontend:

frontend main_https_listen
    bind xxxxxxxxxxxxxx:443
    mode                tcp
    option              tcplog
    xxxxxxx

eu configurei um arquivo no meu rsyslog.d com:

[root@xxxxxxx ~]# cat /etc/rsyslog.d/haproxy.conf
# -----------------------------------------------
# Haproxy specific logging configuration
# -----------------------------------------------
local6.debug             /var/log/haproxy-traffic.log
local6.notice            /var/log/haproxy-admin.log
[root@xxxxxxx ~]#

infelizmente, ambos os arquivos contêm as mesmas informações, por exemplo:

[root@xxxxxxx ~]# tail -11 /var/log/haproxy-admin.log
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy stats started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy main_https_listen started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT35073 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT34305 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT28548 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT28756 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT36702 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_UAT_AT28546 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_PRD_AT28547 started.

[root@xxxxxxx ~]# tail -11 /var/log/haproxy-traffic.log
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy stats started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy main_https_listen started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT35073 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT34305 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT28548 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT28756 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_SIT_AT36702 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_UAT_AT28546 started.
Feb 25 18:05:30 xxxxxxx haproxy[838761]: Proxy backend_PRD_AT28547 started.

enquanto eu esperaria que o log de tráfego gerasse coisas como na documentação, por exemplo:

Feb  6 12:12:56 localhost \
  haproxy[14387]: 10.0.1.2:33313 [06/Feb/2009:12:12:51.443] fnt \
  bck/srv1 0/0/5007 212 -- 0/0/0/0/3 0/0

alguma idéia sobre o que está errado na minha configuração?

obrigado novamente

Saudações

syslog haproxy
  • 1 1 respostas
  • 4748 Views

1 respostas

  • Voted
  1. Best Answer
    olivierg
    2020-02-28T09:20:29+08:002020-02-28T09:20:29+08:00

    encontrei o problema. eu tive que adicionar um "log global" no bloco "frontend" para dizer ao frontend para logar lá:

    frontend main_https_listen
        bind xxxxxx:443
        mode                tcp
        option              tcplog
        log                 global
    

    tão simples como isso. eu posso ver os logs agora, por exemplo:

    Feb 27 18:05:20 xxxxx haproxy[1392050]: xxxxx:61767 [27/Feb/2020:18:05:14.532] main_https_listen backend_PRD_AT28779/server_PRD_AT28779_1 3/1/6315 4031 -- 0/0/0/0/0 0/0
    Feb 27 18:05:20 xxxxx haproxy[1392050]: xxxxx:61767 [27/Feb/2020:18:05:14.532] main_https_listen backend_PRD_AT28779/server_PRD_AT28779_1 3/1/6315 4031 -- 0/0/0/0/0 0/0
    
    • 1

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Você pode passar usuário/passar para autenticação básica HTTP em parâmetros de URL?

    • 5 respostas
  • Marko Smith

    Ping uma porta específica

    • 18 respostas
  • Marko Smith

    Verifique se a porta está aberta ou fechada em um servidor Linux?

    • 7 respostas
  • Marko Smith

    Como automatizar o login SSH com senha?

    • 10 respostas
  • Marko Smith

    Como posso dizer ao Git para Windows onde encontrar minha chave RSA privada?

    • 30 respostas
  • Marko Smith

    Qual é o nome de usuário/senha de superusuário padrão para postgres após uma nova instalação?

    • 5 respostas
  • Marko Smith

    Qual porta o SFTP usa?

    • 6 respostas
  • Marko Smith

    Linha de comando para listar usuários em um grupo do Windows Active Directory?

    • 9 respostas
  • Marko Smith

    O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL?

    • 3 respostas
  • Marko Smith

    Como determinar se uma variável bash está vazia?

    • 15 respostas
  • Martin Hope
    Davie Ping uma porta específica 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    kernel O scp pode copiar diretórios recursivamente? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh retorna "Proprietário incorreto ou permissões em ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil Como automatizar o login SSH com senha? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin Como lidar com um servidor comprometido? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner Como posso classificar a saída du -h por tamanho 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent Como determinar se uma variável bash está vazia? 2009-05-13 09:54:48 +0800 CST

Hot tag

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve