output tcp server return repeat message
jordansissel opened this issue · 0 comments
jordansissel commented
(This issue was originally filed by @binlaniua at elastic/logstash#2181)
new Thread(new Runnable() {
@Override
public void run() {
try {
Socket socket = new Socket("xx", xx);
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String line = null;
while((line = reader.readLine()) != null){
System.out.println("thread one: " +line);
}
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
try {
Socket socket = new Socket("xx", xx);
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String line = null;
while((line = reader.readLine()) != null){
System.out.println("thread two: " +line);
}
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}).start();
the logstash config
input {
file {
path => "xx/access.log"
type => "web_nginx_access"
}
}
output {
tcp {
host => "xx"
port => xx
mode => "server"
}
}
when i access the nginx website, the console print
thread one: {"message":"xx|-|[05/Dec/2014:09:16:49 +0800]|GET / HTTP/1.1|304|0|-|Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36|-|0.000|530|-","@version":"1","@timestamp":"2014-12-05T01:16:50.064Z","type":"web_nginx_access","host":"lin-22-36","path":"xx/access.log"}
thread two: {"message":"xx|-|[05/Dec/2014:09:16:49 +0800]|GET / HTTP/1.1|304|0|-|Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36|-|0.000|530|-","@version":"1","@timestamp":"2014-12-05T01:16:50.064Z","type":"web_nginx_access","host":"lin-22-36","path":"xx/access.log"}
i want the logstash each message to one client, not all.. how can i do..