Skip to content

Enhance access logs#31

Merged
vlaurin merged 3 commits intomainfrom
access-logs-enhancements
Mar 18, 2025
Merged

Enhance access logs#31
vlaurin merged 3 commits intomainfrom
access-logs-enhancements

Conversation

@vlaurin
Copy link
Copy Markdown
Contributor

@vlaurin vlaurin commented Mar 18, 2025

Refactor access logs KVP for more legible and more useful logs, allowing grouping of logs per endpoint to compute fine grained performance stats.

Sample of new format:

{
    "timestamp": 1742294576376,
    "level": "INFO",
    "threadName": "http-nio-4452-exec-2",
    "loggerName": "app.quickcase.sdk.spring.logging.AccessLogFilter",
    "mdc": {
        "traceId": "9e89ed02-3c16-4b37-a9ac-8a02ca8953b4",
        "reference": "1727780880109118",
        "event": "39"
    },
    "message": "Request processed (200) in 366ms: GET \/cases\/1727780880109118\/events\/39",
    "kvp": {
        "duration": "366",
        "method": "GET",
        "match": "\/cases\/{caseReference}\/events\/{id}",
        "uri": "\/cases\/1727780880109118\/events\/39",
        "status": "200"
    }
}

vlaurin added 3 commits March 18, 2025 09:41
Context is provided by logger name. In this context repeating the word `request` is redundant and keys can be simplified and shortened to reduce log volume.
To allow for grouping of access logs per endpoint, add the matched URI pattern to the access log KVP.
The path variables are NOT included in the KVP as they would duplicate the MDC content most of the time.
Left over from access log level strategy abstraction
@vlaurin vlaurin merged commit 3132e4b into main Mar 18, 2025
2 checks passed
@vlaurin vlaurin deleted the access-logs-enhancements branch March 18, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants