zoukankan      html  css  js  c++  java
  • Haproxy 开启日志记录

    安装部署完Haproxy之后,默认是没有开启日志记录的,需要相应的手工配置使其日志功能开启。

       

    【创建日志记录文件夹】

    mkdir /var/log/haproxy
    chmod a+x /var/log/haproxy

       

    【开启rsyslog记录haproxy日志功能】

    vim /etc/rsyslog.conf

       

    修改:

    # Provides UDP syslog reception

    $ModLoad imudp

    $UDPServerRun 514

    开启514 UDP监听

       

    添加:

    # Save haproxy log

    local0.* /var/log/haproxy/haproxy.log

    指定日志存放点

       

    【修改/etc/sysconfig/rsyslog】

    vim /etc/sysconfig/rsyslog

       

    添加以下内容:

    # Options for rsyslogd

    # Syslogd options are deprecated since rsyslog v3.

    # If you want to use them, switch to compatibility mode 2 by "-c 2"

    # See rsyslogd(8) for more details

    SYSLOGD_OPTIONS="-r -m 0 -c 2"

       

    【haproxy配置】

    vim /etc/haproxy/haproxy.conf

       

    添加:

    global #在此上级目录下配置

    log 127.0.0.1 local0 info

    配置local0事件

       

    【验证服务是否生效】

    ###重启服务

    systemctl restart haproxy

    systemctl restart rsyslog

       

    ###查看日志记录

    tailf /var/log/haproxy/haproxy.log

       

  • 相关阅读:
    linux tmux基本操作
    AJAX json集合传入Controller后台
    python 数据读取
    appium
    接口测试设计思路
    python 常用模块
    接口测试程序部分
    测试用例设计思路
    mock_待续
    网站收藏
  • 原文地址:https://www.cnblogs.com/liufarui/p/11078172.html
Copyright © 2011-2022 走看看