Latest commit 6c4c8d8 Jan 14, 2017 @emag emag committed with kenfinnigan SWARM-977: Enable Logstash example (#121)
Enable Logstash example and rewrite it simpler.

README.md

Logstash Example

This example sends log messages to Logstash.

Please raise any issues found with this example in our JIRA: https://issues.jboss.org/browse/SWARM

Start Logstash

Local installed

cd $LOGSTASH_HOME
bin/logstash -f /this/project/pipeline/logstash-wildfly.conf

Docker

docker run --rm -it \
  -v /this/project/pipeline:/usr/share/logstash/pipeline \
  -p 9300:9300 \
  docker.elastic.co/logstash/logstash:5.1.1

Build & Run Example

mvn clean package
java -jar target/examples-logstash-swarm.jar

Example Requests

If you access the app APIs, you can see the following log in Logstash console.

curl localhost:8080/info
{
     "loggerClassName" => "org.jboss.logging.Logger",
               "level" => "INFO",
             "message" => "This is INFO message",
                 "ndc" => "",
                 "mdc" => {},
          "threadName" => "default task-2",
                "tags" => [],
            "threadId" => 162,
            "sequence" => 27,
          "@timestamp" => 2017-01-06T13:58:55.380Z,
                "port" => 35318,
            "@version" => 1,
                "host" => "127.0.0.1",
    "wildflySwarmNode" => "your-host-name",
          "loggerName" => "org.wildfly.examples.swarm.logstash.MyResource"
}

APIs

  • /debug
  • /info
  • /warn
  • /error
  • /exception