quarkusio/quarkus

Structured Access Logs

Open

#23,407 创建于 2022年2月3日

在 GitHub 查看
 (6 评论) (10 反应) (0 负责人)Java (12,967 star) (2,464 fork)batch import
area/logginggood first issuekind/enhancement

描述

Description

As an SRE I would like the access logs to emit structured information when using quarkus-logging-json So that I can filter logs more efficiently

At the moment when using Quarkus access logging with something like Splunk or Kibana, important information like response status code, request URI, response size etc is only available in the message

These should be available as separate JSON properties on the log event so that I can easily filter the logs

Implementation ideas

logback-access does this well when combined with logstash-logback-encoder and emits something along the lines of:

{
  "@timestamp": "2021-05-04T18:24:25.720+01:00",
  "status_code": 404,
  "method": "GET",
  "protocol": "HTTP/1.1",
  "requested_uri": "/api/v1/resource/12345678",
  "remote_host": "127.0.0.1",
  "content_length": -1,
  "elapsed_time": 76,
  "level": "DEBUG",
  "logger_name": "access.log",
  "message": "127.0.0.1 - - [2021-05-04T18:24:25.720+0100] \"GET /api/v1/resource/12345678 HTTP/1.1\" 404 -1",
}

贡献者指南