Loadbalancing Logback logstash logs using HAProxy

2019-09-14 12:36发布

IP Address:

  1. Web Application -> 192.168.x.209
  2. HAProxy -> 192.168.x.211
  3. Logstash Shipper -> 192.168.x.210

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.

Following are the configurations I did:

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 Config

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 Shipper - config

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.

1条回答
别忘想泡老子
2楼-- · 2019-09-14 13:23

Found the issue.

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

service iptables stop 
setenv 0
查看更多
登录 后发表回答