Logstash Logging in Spring Boot
Usages
This library helps to send logs automatically to Logstash.
Features
The main feature provided by logstash-logback-spring-boot-starter
:
- automatically configured the spring boot application to send logs to Logstash.
Getting started
Available on Maven Central.
<dependency>
<groupId>io.github.bhuwanupadhyay</groupId>
<artifactId>logstash-logback-spring-boot-starter</artifactId>
<version>1.0.3</version>
</dependency>
Auto-configuration enable logstash logging automatically, and connected with logstash server url localhost:5044
.
In case if you have to change logstash server url, override following properties:
boot:
logstash:
destination: localhost:5044
By default custom fields are:
{ "appname" : "<spring.application.name>" }
To disable logstash logging, override following properties:
boot:
logstash:
enabled: false
All configuration properties:
boot:
logstash:
destination: localhost:5044
enabled: true
key-store-location: keystore/trust.pk
key-store-password: 12345
custom-fields: |-
{"appname":"${spring.application.name}", "env": "${spring.profiles.active}"}
queue-size: 512
Demo
Thank you!