wildfly-logstash does not send logs to logstash

  docker, jboss, keycloak, logstash, wildfly

I am using jboss/keycloak:11.0.2 and wildfly-logstash (https://github.com/kifj/wildfly-logstash) for transferring logs from wildfly to logstash. I met a problem when logstash up earlier than wildfly in this case logs do not send to logstash. Sometimes I see log like this
myHost: Name or service not known. Logger does not try to reconnect to myHost. An only restart helps. Wildfly startup script example:

embed-server --server-config=standalone-ha.xml --std-out=echo
module add --name=x1.wildfly-logstash --dependencies=org.jboss.logmanager,org.jboss.logging,javax.json.api --resources=/tmp/wildfly-logstash.jar

/subsystem=logging/custom-formatter=LOGSTASH-PATTERN:add(
  class=net.logstash.logging.formatter.LogstashUtilFormatter,
  module=x1.wildfly-logstash)

/subsystem=logging/custom-handler=LOGSTASH-SOCKET:add(level=DEBUG, class=net.logstash.logging.handler.SocketHandler,module=x1.wildfly-logstash,named-formatter=LOGSTASH-PATTERN,properties={hostname=myHost, port=${env.port}})

/subsystem=logging/async-handler=LOGSTASH-ASYNC:add(queue-length=512, subhandlers=[LOGSTASH-SOCKET])

/subsystem=logging/root-logger=ROOT:add-handler(name=LOGSTASH-ASYNC)

stop-embedded-server

Source: Docker Questions

LEAVE A COMMENT