JohnyzHub / jakartaee-elastic-fluentd-kibana

A simple jakarta ee service using fluentd logging mechanism plugged to elastic search with kibana

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Eclipse Starter for Jakarta EE

This is a sample application generated by the Eclipse Foundation starter for Jakarta EE.

You can run the application by executing the following command from the directory where this file resides. Please ensure you have installed a Java SE 8+ implementation appropriate for your Jakarta EE version and runtime choice (we have tested with Java SE 8, Java SE 11 and Java SE 17). Note, the Maven Wrapper is already included in the project, so a Maven install is not actually needed. You may first need to execute chmod +x mvnw.

./mvnw clean package cargo:run

Once the runtime starts, you can access the project at http://localhost:8080/jakartaee-hello-world.

You can also run the project via Docker. To build the Docker image, execute the following commands from the directory where this file resides. Please ensure you have installed a Java SE 8+ implementation appropriate for your Jakarta EE version/runtime choice and Docker (we have tested with Java SE 8, Java SE 11 and Java SE 17). Note, the Maven Wrapper is already included in the project, so a Maven install is not actually needed. You may first need to execute chmod +x mvnw.

./mvnw clean package
docker build -t jakartaee-hello-world:v1 .

You can then run the Docker image by executing:

docker run -it --rm -p 8080:8080 jakartaee-hello-world:v1

Once the runtime starts, you can access the project at http://localhost:8080/jakartaee-hello-world.

Run EFK Stack

To run the elastic-search, fluentd and kibana to index and search the logs, execute the below docker-compose command

docker-compose build && docker-compose up -d

At the time of writing this, the jakarta ee container is not starting cleanly as it is little early than fluentd. You may see error response similar to 'Error response from daemon: failed to create task for container: failed to initialize logging driver: dial tcp [::1]:24224: connect: connection refused'


So, it may need a restart, either by executing the 'docker-compose up -d' command again or manual restart the contaiiner using docker desktop ui.
Once all the services are ready, open a browser and hit the below url several time with new name each time

localhost:8080/jakartaee-hello-world/rest/hello?name=Name1

This should generate few logs. Now open the elastic-kibana UI using the below url

http://localhost:5601/

Once the elastic-kibana ui appears, choose 'Discover' link from the left menu panel, you should be asked to create an index.

image

image

image

About

A simple jakarta ee service using fluentd logging mechanism plugged to elastic search with kibana


Languages

Language:HTML 53.3%Language:Java 34.5%Language:Dockerfile 12.2%