概要
A library for logging HTTP request/response for Spring Boot application and integration with Elastic Stack
Web・アプリ開発できること
- It is able to log all incoming HTTP requests and outgoing HTTP responses with full body, and send those logs to Logstash with the proper tags
- It is able to calculate and store an execution time for each request
- It generates and propagates correlationId for downstream services calling with Spring RestTemplate or OpenFeign
- It is auto-configurable Spring Boot library – you don’t have to do anything more than including it as a dependency to your application to make it work
計測したスター増加
- 24時間
- 0
- 7日間
- 0
- 15日間
- +1
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルLogging with Spring Boot and Elastic Stack 
Main purpose
This library is created for logging incoming HTTP requests and outgoing HTTP responses and send these logs automatically to Logstash.
Articles
Detailed description can be found here:
- Logging with Spring Boot and Elastic Stack
- Using logstash-logging-spring-boot-starter for logging with Spring Boot and Logstash
Features
In short, let’s begin from a brief review of main features provided by logstash-logging-spring-boot-starter:
- It is able to log all incoming HTTP requests and outgoing HTTP responses with full body, and send those logs to Logstash with the proper tags
- It is able to calculate and store an execution time for each request
- It generates and propagates correlationId for downstream services calling with Spring RestTemplate or OpenFeign
- It is auto-configurable Spring Boot library – you don’t have to do anything more than including it as a dependency to your application to make it work
Getting started
The current version of library is 3.1.0.
For logging with Spring WebMvc and Logstash:
<dependency>
<groupId>com.github.piomin</groupId>
<artifactId>logstash-logging-spring-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>
For logging with Spring WebMvc and Loki:
<dependency>
<groupId>com.github.piomin</groupId>
<artifactId>loki-logging-spring-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>
For logging with Spring WebFlux:
<dependency>
<groupId>com.github.piomin</groupId>
<artifactId>reactive-logstash-logging-spring-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>
By default, the library is enabled, but tries to locate Logback configuration inside your application to settings for Logstash appender. If such appender won’t be found, the library uses Spring Boot default logging configuration, which does not include Logstash appender. To force it use auto-configured appender definition inside library we have to set property logging.logstash.enabled to true.
logging.logstash:
enabled: true
url: loki.example.com:5000
Manual add jar to pom.xml
Add reactive-logstash-logging-spring-boot-starter-3.1.0.pom to ${basedir}/dependencies
Add pom.xml to ${basedir}/dependencies and rename to reactive-logstash-logging-spring-boot-starter-3.1.0.pom
Add this script to pom.xml in plugins section.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<groupId>com.github.piomin</groupId>
<artifactId>reactive-logstash-logging-spring-boot-starter</artifactId>
<version>3.1.0</version>
<packaging>jar</packaging>
<file>${basedir}/dependencies/reactive-logstash-logging-spring-boot-starter-3.1.0.jar</file>
<generatePom>false</generatePom>
<pomFile>${basedir}/dependencies/reactive-logstash-logging-spring-boot-starter-3.1.0.RELEASE.pom</pomFile>
</configuration>
<executions>
<execution>
<id>install-jar-lib</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
関連プロジェクトを探す
読み込み中…