Skip to content

Instantly share code, notes, and snippets.

@renalexster
Created July 6, 2018 14:45
Show Gist options
  • Save renalexster/71a30a64b2b3ffaafa6705c103dd05b8 to your computer and use it in GitHub Desktop.
Save renalexster/71a30a64b2b3ffaafa6705c103dd05b8 to your computer and use it in GitHub Desktop.
logstash-wildfly
curl -O https://repository.jboss.org/nexus/service/local/repositories/releases/content/org/jboss/logmanager/jboss-logmanager-ext/1.0.0.Alpha3/jboss-logmanager-ext-1.0.0.Alpha3.jar
batch
# Add the module, replace the directory on the resources attribute to the path where you downloaded the jboss-logmanager-ext library
module add --name=org.jboss.logmanager.ext --dependencies=org.jboss.logmanager,javax.json.api,javax.xml.stream.api --resources=~/jboss-logmanager-ext-1.0.0.Alpha5.jar
# Add the logstash formatter
/subsystem=logging/custom-formatter=logstash:add(class=org.jboss.logmanager.ext.formatters.LogstashFormatter,module=org.jboss.logmanager.ext)
# Add a socket-handler using the logstash formatter. Replace the hostname and port to the values needed for your logstash install
/subsystem=logging/custom-handler=logstash-handler:add(class=org.jboss.logmanager.ext.handlers.SocketHandler,module=org.jboss.logmanager.ext,named-formatter=logstash,properties={hostname=logstash, port=8000})
# Add the new handler to the root-logger
/subsystem=logging/root-logger=ROOT:add-handler(name=logstash-handler)
# Reload the server which will boot the server into normal mode as well as write messages to logstash
:reload
run-batch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment