From 9891eb9961d9e1f5fb1003d6d0445eb7b4d5850b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Skj=C3=B8lberg?= Date: Thu, 30 Apr 2026 11:06:58 +0200 Subject: [PATCH 1/3] Increase request-response max log statement size for GCP --- .../spring/logbook/gcp/LogbookGcpAutoConfiguration.java | 8 +++++--- .../RequestResponseGcpGrpcSpringAutoConfiguration.java | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gcp/logbook-spring-boot-autoconfigure-gcp/src/main/java/no/entur/logging/cloud/spring/logbook/gcp/LogbookGcpAutoConfiguration.java b/gcp/logbook-spring-boot-autoconfigure-gcp/src/main/java/no/entur/logging/cloud/spring/logbook/gcp/LogbookGcpAutoConfiguration.java index e7f47480..e52e13d3 100644 --- a/gcp/logbook-spring-boot-autoconfigure-gcp/src/main/java/no/entur/logging/cloud/spring/logbook/gcp/LogbookGcpAutoConfiguration.java +++ b/gcp/logbook-spring-boot-autoconfigure-gcp/src/main/java/no/entur/logging/cloud/spring/logbook/gcp/LogbookGcpAutoConfiguration.java @@ -13,9 +13,11 @@ public class LogbookGcpAutoConfiguration { @Bean public LogbookLoggingCloudProperties logbookCloudConfiguration() { LogbookLoggingCloudProperties c = new LogbookLoggingCloudProperties(); - // subtract a few kb for headers and other wrapping - c.setMaxBodySize(131072 - 2 * 1024); - c.setMaxSize(131072); + // hard limit as of April 2026: 256 KiB - where KiB is 1024 bytes + // Body: set it to 224 KiB to be on the safe side, + // and to allow for a lot of overhead in the logging framework, MDC, HTTP headers, etc. + c.setMaxBodySize(229376); + c.setMaxSize(262144 - 2 * 1024); // inaccurate + currently not enforced return c; } } \ No newline at end of file diff --git a/gcp/request-response-spring-boot-starter-gcp-grpc-spring/src/main/java/no/entur/logging/cloud/gcp/spring/gcp/grpc/spring/RequestResponseGcpGrpcSpringAutoConfiguration.java b/gcp/request-response-spring-boot-starter-gcp-grpc-spring/src/main/java/no/entur/logging/cloud/gcp/spring/gcp/grpc/spring/RequestResponseGcpGrpcSpringAutoConfiguration.java index 1bb8003b..ddb69c78 100644 --- a/gcp/request-response-spring-boot-starter-gcp-grpc-spring/src/main/java/no/entur/logging/cloud/gcp/spring/gcp/grpc/spring/RequestResponseGcpGrpcSpringAutoConfiguration.java +++ b/gcp/request-response-spring-boot-starter-gcp-grpc-spring/src/main/java/no/entur/logging/cloud/gcp/spring/gcp/grpc/spring/RequestResponseGcpGrpcSpringAutoConfiguration.java @@ -13,9 +13,11 @@ public class RequestResponseGcpGrpcSpringAutoConfiguration { @Bean public GrpcLoggingCloudProperties grpcLoggingCloudProperties() { GrpcLoggingCloudProperties c = new GrpcLoggingCloudProperties(); - // subtract a few kb for headers and other wrapping - c.setMaxBodySize(131072 - 2 * 1024); - c.setMaxSize(131072); + // hard limit as of April 2026: 256 KiB - where KiB is 1024 bytes + // Body: set it to 224 KiB to be on the safe side, + // and to allow for a lot of overhead in the logging framework, MDC, HTTP headers, etc. + c.setMaxBodySize(229376); + c.setMaxSize(262144 - 2 * 1024); // inaccurate + currently not enforced return c; } } From c0890de5e1870c13226d2a7aa758643a6ad95d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Skj=C3=B8lberg?= Date: Thu, 30 Apr 2026 11:12:39 +0200 Subject: [PATCH 2/3] Adjust comment --- .../cloud/spring/logbook/gcp/LogbookGcpAutoConfiguration.java | 2 +- .../spring/RequestResponseGcpGrpcSpringAutoConfiguration.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcp/logbook-spring-boot-autoconfigure-gcp/src/main/java/no/entur/logging/cloud/spring/logbook/gcp/LogbookGcpAutoConfiguration.java b/gcp/logbook-spring-boot-autoconfigure-gcp/src/main/java/no/entur/logging/cloud/spring/logbook/gcp/LogbookGcpAutoConfiguration.java index e52e13d3..f1a4e255 100644 --- a/gcp/logbook-spring-boot-autoconfigure-gcp/src/main/java/no/entur/logging/cloud/spring/logbook/gcp/LogbookGcpAutoConfiguration.java +++ b/gcp/logbook-spring-boot-autoconfigure-gcp/src/main/java/no/entur/logging/cloud/spring/logbook/gcp/LogbookGcpAutoConfiguration.java @@ -15,7 +15,7 @@ public LogbookLoggingCloudProperties logbookCloudConfiguration() { LogbookLoggingCloudProperties c = new LogbookLoggingCloudProperties(); // hard limit as of April 2026: 256 KiB - where KiB is 1024 bytes // Body: set it to 224 KiB to be on the safe side, - // and to allow for a lot of overhead in the logging framework, MDC, HTTP headers, etc. + // and to allow for a lot of overhead in the logging framework, MDC, HTTP headers, bytes vs chars, etc. c.setMaxBodySize(229376); c.setMaxSize(262144 - 2 * 1024); // inaccurate + currently not enforced return c; diff --git a/gcp/request-response-spring-boot-starter-gcp-grpc-spring/src/main/java/no/entur/logging/cloud/gcp/spring/gcp/grpc/spring/RequestResponseGcpGrpcSpringAutoConfiguration.java b/gcp/request-response-spring-boot-starter-gcp-grpc-spring/src/main/java/no/entur/logging/cloud/gcp/spring/gcp/grpc/spring/RequestResponseGcpGrpcSpringAutoConfiguration.java index ddb69c78..37ad5100 100644 --- a/gcp/request-response-spring-boot-starter-gcp-grpc-spring/src/main/java/no/entur/logging/cloud/gcp/spring/gcp/grpc/spring/RequestResponseGcpGrpcSpringAutoConfiguration.java +++ b/gcp/request-response-spring-boot-starter-gcp-grpc-spring/src/main/java/no/entur/logging/cloud/gcp/spring/gcp/grpc/spring/RequestResponseGcpGrpcSpringAutoConfiguration.java @@ -15,7 +15,7 @@ public GrpcLoggingCloudProperties grpcLoggingCloudProperties() { GrpcLoggingCloudProperties c = new GrpcLoggingCloudProperties(); // hard limit as of April 2026: 256 KiB - where KiB is 1024 bytes // Body: set it to 224 KiB to be on the safe side, - // and to allow for a lot of overhead in the logging framework, MDC, HTTP headers, etc. + // and to allow for a lot of overhead in the logging framework, MDC, HTTP headers, bytes vs chars, etc. c.setMaxBodySize(229376); c.setMaxSize(262144 - 2 * 1024); // inaccurate + currently not enforced return c; From dc710354460663fe829f644a552c54c4546b610b Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Apr 2026 11:40:19 +0200 Subject: [PATCH 3/3] docs: add GCP max log size documentation to guides (#360) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docs: add max size documentation to guides for PR 359 Agent-Logs-Url: https://github.com/entur/cloud-logging/sessions/74545817-1849-4728-ac34-f3cd25df704f Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com> Co-authored-by: Thomas Skjølberg --- guides/gRPC.md | 9 +++++++++ guides/troubleShooting.md | 2 +- guides/web.md | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/guides/gRPC.md b/guides/gRPC.md index b8156088..a7d889ac 100644 --- a/guides/gRPC.md +++ b/guides/gRPC.md @@ -163,6 +163,15 @@ testImplementation ("no.entur.logging.cloud:request-response-spring-boot-starter ``` +Please note: + + * GCP `LogEntry` has a hard size limit of 256 KiB. Request/response bodies are truncated at 224 KiB by default to stay safely within this limit, accounting for headers, MDC fields, and other log-framework overhead. Override the default using: + ``` + entur.logging.request-response.max-body-size= + entur.logging.request-response.max-size= + ``` + See also: [Too long lines](troubleShooting.md#too-long-lines). + Adjust the logger using ``` diff --git a/guides/troubleShooting.md b/guides/troubleShooting.md index 8f2404dc..cb0ac73f 100644 --- a/guides/troubleShooting.md +++ b/guides/troubleShooting.md @@ -136,4 +136,4 @@ Does not always translate into `textPayload`. > Failed to process request with tag kube_abt-xxx_abt-ccc-79d5974b67-jdsk8_abt-ccc_stdout: rpc error: code = InvalidArgument desc = Log entry with size 278.8K exceeds maximum size of 256.0K -Resolution: Truncate long values. \ No newline at end of file +Resolution: Truncate long values. For request-response logging, the library automatically truncates request/response bodies at 224 KiB by default (GCP `LogEntry` max is 256 KiB). The limit can be lowered further via `entur.logging.request-response.max-body-size`. \ No newline at end of file diff --git a/guides/web.md b/guides/web.md index 2f7f9299..d17c8e35 100644 --- a/guides/web.md +++ b/guides/web.md @@ -130,6 +130,12 @@ Please note: * For request-response-logging, this library assumes that locally produced JSON has valid syntax and is without pretty-printing. * This assumption is made so to avoid the processing overhead of unnecessarily parsing JSON documents known to be valid. * If this assumption for some reason does not hold, use a BodyFilter to compensate. + * GCP `LogEntry` has a hard size limit of 256 KiB. Request/response bodies are truncated at 224 KiB by default to stay safely within this limit, accounting for headers, MDC fields, and other log-framework overhead. Override the default using: + ``` + entur.logging.request-response.max-body-size= + entur.logging.request-response.max-size= + ``` + See also: [Too long lines](troubleShooting.md#too-long-lines). Some Logbook excludes ([actuator, openapi](https://github.com/entur/cloud-logging/blob/main/request-response/logbook-spring-boot-autoconfigure/src/main/java/no/entur/logging/cloud/spring/logbook/LogbookLoggingAutoConfiguration.java)) are included by default. Add more using