0

I'm a beginner with wildfly logging and I'm trying to add more information in the log generated by Jboss, like the Hostname (instead of the ip adress)

I'm using Wildfly 10 with the jboss-logmanager-ext who sent logs to logstash 6.7.1 each one in a docker container

jboss-logmanager-ext-1.0.0.Alpha5.jar is added inside Wildfly using CLI, here is the logstash formatter line :

# Add the logstash formatter
/subsystem=logging/custom-formatter=logstash:add(class=org.jboss.logmanager.ext.formatters.LogstashFormatter,module=org.jboss.logmanager.ext)

Actually my log looks like that :

{
          "host" => "172.17.0.3",
          "port" => 46176,
       "message" => "...",
      "@version" => "1",
    "@timestamp" => 2019-04-09T10:07:57.354Z
}

I want to add a field hostname and perhaps other things later, is it possible without adding a new module to do a custom pattern ? with XML file or other ? I have only find external module like Logstash/Gelf

Aliiiiiiii
  • 15
  • 1
  • 9

1 Answers1

0

You could try adding the jboss.qualified.host.name or jboss.home.name system properties.

/subsystem=logging/custom-handler=logstash:write-attribute(value=meta-data, value={"qualifiedHost=${jboss.qualified.host.name}"})
James R. Perkins
  • 16,800
  • 44
  • 60
  • Thanks ! I just have an issue with your syntax and used this one and it works : /subsystem=logging/custom-formatter=logstash:write-attribute(name=properties, value={metaData="qualifiedHost=${jboss.qualified.host.name}"}) – Aliiiiiiii Apr 15 '19 at 11:49
  • Good catch! I fixed the sample to move the quote to the correct place. – James R. Perkins Apr 15 '19 at 23:46