Skip to content

Commit

Permalink
feat: add content length on access log
Browse files Browse the repository at this point in the history
close #1154
  • Loading branch information
rahulkeshervani authored Mar 6, 2025
1 parent 2cf66b5 commit ffbc988
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private void log(HttpResponse<?> response) {
if (accessLogger.isInfoEnabled()) {
final long timeElapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
final int status = status(response);

long contentLength = response.getContentLength();
String message = MessageFormatter.arrayFormat(
logFormat,
new Object[]{
Expand All @@ -166,6 +166,7 @@ private void log(HttpResponse<?> response) {
status,
inetAddress,
user,
contentLength
}
).getMessage();

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ akhq:
access-log:
enabled: true
name: org.akhq.log.access
format: "[Date: {}] [Duration: {} ms] [Url: {} {}] [Status: {}] [Ip: {}] [User: {}]"
format: "[Date: {}] [Duration: {} ms] [Url: {} {}] [Status: {}] [Ip: {}] [User: {}] [Length: {}]"
filters:
- "((?!/health).)*"

Expand Down

0 comments on commit ffbc988

Please sign in to comment.