log4j:ERROR Could not connect to remote log4j server at Logstash-server-IP

Hello,

Below is the application log4j.xml file,

<?xml version="1.0" encoding="UTF-8" ?>

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">

</log4j:configuration>

And below is the logstash configuration file for same application,

input {
log4j {
mode => "server"
port => 4994
type => "log4j"
}
}

output {
stdout {}
elasticsearch { codec => rubydebug
hosts => "ElasticsearchIP"
index => "login"
}
}

Below are the logs of my spark application executor,

log4j:ERROR Could not connect to remote log4j server at [LogstashHostname.example.com]. We will try again later.

And below are the logs of spark application driver,

log4j: Attempting connection to LogstashHostname.example.com
log4j: Remote host LogstashHostname.example.com refused connection.
log4j: Attempting connection to LogstashHostname.example.com
log4j: Remote host LogstashHostname.example.com refused connection.
log4j: Attempting connection to LogstashHostname.example.com
log4j: Remote host LogstashHostname.example.com refused connection.
log4j: Attempting connection to LogstashHostname.example.com
log4j: Remote host LogstashHostname.example.com refused connection.

Can you please let me know what can be the cause of these errors?

Check that

  • Logstash is actually starting up properly,
  • that it's listening on port 4994 (use e.g. netstat), and
  • that there's no firewall blocking the access.

Please note that the log4j input has been depreacted. I strongly suggest you don't use it.

@magnusbaeck Thanks for the reply.

All above scenarios, I have checked. No issue with that.

Can you please suggest alternative for log4j for spark applications and Ignite logs/

The log4j plugin documentation suggests what should be used instead.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.