简体   繁体   中英

How to launch logback + logstash on local machine?

I have to test some features on logback + logstash bunch with tcp connection. I have downloaded logstash application. Configured that like this:

input {
tcp {
    port => "4560"
    codec => json_lines
}

} output {
  stdout { codec => rubydebug } 
}

start it with

.\bin\logstash.bat -f .\config\logstash-tcp.conf

It was start with message:

[2020-02-18T10:33:23,910][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}

Now, i have a Java app in my ide, which one should log info with logback into local lockstash via tcp connection. I have logback.xml file configured like this:

    <appender name="LOGSTASH_TCP" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
    <destination>127.0.0.1:4560</destination>
    <writeBufferSize>65536</writeBufferSize>
    <ringBufferSize>65536</ringBufferSize>
    <reconnectionDelay>5 second</reconnectionDelay>
    <droppedWarnFrequency>100</droppedWarnFrequency>
    <encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>

<root level="debug">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="LOGSTASH_TCP"/>
</root>

Now, when i'am trying to log somthing, in logstash console i seeing that message:

[2020-02-18T10:40:23,373][ERROR][logstash.inputs.tcp      ][main] Error in Netty pipeline: java.io.IOException: An existing connection was forcibly closed by the remote host

I would very appreciate if someone could help with this issue.

Ok, it was not a problem. My app really was and it's work and shut down connection)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM