使用HAProxy进行负载平衡Logback Logstash日志 [英] Loadbalancing Logback logstash logs using HAProxy

查看:250
本文介绍了使用HAProxy进行负载平衡Logback Logstash日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IP地址:

  1. Web应用程序-> 192.168.x.209
  2. HAProxy-> 192.168.x.211
  3. Logstash托运人-> 192.168.x.210
  1. Web Application -> 192.168.x.209
  2. HAProxy -> 192.168.x.211
  3. Logstash Shipper -> 192.168.x.210

使用以下配置,HAProxy无法从Logstash应用程序接收日志,因此Logstash发货人无法接收日志.

With the below configuration, HAProxy is not able to receive logs from Logstash application and thus logstash shipper is not able to receive the logs.

以下是我所做的配置:

WebApplication-logback.xml

<appender name="stash"
    class="net.logstash.logback.appender.LogstashAccessTcpSocketAppender">
    <destination>192.168.x.211:5001</destination>
    <encoder class="net.logstash.logback.encoder.LogstashEncoder" />
</appender>

HAProxy配置

listen logstash
    bind  :5001
    mode tcp
    balance leastconn
    option tcplog
    server logstash01 192.168.x.212:5001 check
    server logstash02 192.168.x.210:5001 check

Logstash发货人-配置

input{
    tcp{
            type => "log1"
            port => 5001
            codec => "json"
    }
    tcp{
            type => "log2"
            port => 5002
            codec => "json"
    }
output {
            stdout{
            codec => rubydebug
    }}

配置是否有问题?需要帮助.

Is there anything wrong with the configuration? help required.

推荐答案

发现了问题.

这是因为防火墙规则处于活动状态.将其关闭后,一切按预期进行.

This was because firewall rules were active. After shutting it down, things worked as expected.

service iptables stop 
setenv 0

这篇关于使用HAProxy进行负载平衡Logback Logstash日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆