1

I have some question about log level in haproxy. Using haproxy, on the backend there is a database. I need to log errors in a separate file, but cant understand how to do that. I know about log-separate-errors. Maybe I need to add another one log file to the syslog-ng.conf?

Here is my configuration

global
        log 127.0.0.1  local0
        log 127.0.0.1  local1 notice
        stats socket /var/run/haproxy.stat mode 600 level admin
        stats timeout 30s
        user haproxy
        group haproxy
        daemon

defaults
        log global
        option dontlognull     
        option redispatch       
        retries 3               
        maxconn 15000
        timeout connect 8000  
        timeout client 80000    
        timeout server 80000
frontend base
        bind *:5050
        mode tcp
        log-format [%t]\ from\ %ci:%cp\ to\ %si:%sp\ %ts\ %Tt
        default_backend backend
backend backend
        mode tcp
        balance roundrobin
        server  base_1   check inter 5000 fall 3 rise 2
        server  base_2   check inter 5000 fall 3 rise 2

And here is syslog-ng

 destination t_haproxy_acc {
  file(
    "/var/log/haproxy/access.log",
    template(t_haproxy_acc));
};
destination t_haproxy_sys {
  file(
    "/var/log/haproxy/info.log",
    template(t_haproxy_sys));
};
filter f_haproxy_acc {
  program(haproxy) and level(info);
};
filter f_haproxy_sys {
  program(haproxy) and not level(info);
};
log { source(s_src); filter(f_haproxy_acc); destination(t_haproxy_acc); };
log { source(s_src); filter(f_haproxy_sys); destination(t_haproxy_sys); };
Daniel Schneller
  • 13,728
  • 5
  • 43
  • 72
user3904465
  • 41
  • 2
  • 8

0 Answers0