Sample project to show log forwarding from a Spring Boot application to Splunk via a file forwarder.
Sleuth is also added to generate IDs for each request
Build the application as a Docker image using:
mvn clean package
Run the included docker-compose file with:
docker-compose up
This will bring up three containers: A demo application, Splunk, and a Spunk Forwarder.
Logs are forwarded to Splunk via a shared volume between the application and forwarder.
It is possible to send logs to Splunk via Docker's logging mechanism, but the goal here was to use the file forwarder to replicate a production setup.
Application startup will generate some logs.
Calling the demo endpoint will generate some more logs, with Sleuth trace and Span Ids.
curl http://localhost:8080?name=test
Got to Splunk login to view the logs.
Login is admin/password
Stop the containers and remove unused volumes with:
docker-compose down -v