Loadbalancing Logback logstash logs using HAProxy

佐手、 提交于 2019-12-25 06:59:38

问题


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:


Found the issue.

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

service iptables stop 
setenv 0


来源:https://stackoverflow.com/questions/36865109/loadbalancing-logback-logstash-logs-using-haproxy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!