I'm trying to launch few Logstash instances behind the proxy.
I'm using nginx, but HAProxy is an option as well.
worker_processes 4;
events {
worker_connections 1024;
}
http {
upstream streams {
server logstash_ip:5044;
}
server {
listen 80;
location / {
rewrite ^/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_pass http://streams;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
}
}
logstash_ip
is an alias, it is resolvable.
The problem is that when I'm pushing some logs directly to the logstash – everything is ok.
When I'm pushing logs through the Nginx it fails:
- Navigating Nginx with port gives me 502 Gateway error
-
Logstash logs
Error publishing events (retrying): lumberjack protocol error
Best Answer
Which is true, as the
lumberjack
protocol is not one based onhttp
, which is what Nginx is expecting in your configuration. I suggest trying astream { }
block instead for nginx, as that's designed for TCP-protocols.