I am sending data to 9516 port on nginx server . From this server I want to forward it to two syslog-ng servers using roundrobin method. I have below nginx.conf file, with this I am able to load balance my kibana webpage but I am not sure where and how I can read 9516 port and then forward it to syslog-ng machine .
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
upstream kibana {
server1:30001;
server2:30001;
}
server { # simple load balancing
listen 80;
server_name nginxIP;
# SSL Certificate, Key and Settings
ssl_certificate /etc/pki/tls/certs/ELK-Stack.crt ;
ssl_certificate_key /etc/pki/tls/private/ELK-Stack.key;
ssl_session_cache shared:SSL:10m;
# Basic authentication using the account created with htpasswd
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/htpasswd.users;
location / {
proxy_pass http://kibana;
}
}
I took help from above and tried to add below but I am getting an error
upstream syslog-ng {
syslog-ng-server1:9516;
syslog-ng-server2:9516;
}
server { # simple load balancing
listen 9516;
server_name nginxIP;
location / {
proxy_pass http://syslog-ng;
}
}
Error While sending log on 9516 port using netcat command
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>
Please help.
Regards VG