Minimizing GKE Logging Costs with SYSTEM Mode
Short answer
A Run the gcloud container clusters update --logging=SYSTEM command for the development cluster.
Question
Key Takeaways
The question tests the difference between SYSTEM and WORKLOAD logging modes in GKE, specifically targeting the cost optimization aspect of operational logging.
This page explains how to configure Google Kubernetes Engine (GKE) logging to minimize costs by disabling workload log ingestion while retaining essential operational logs.
Common mistake: Many learners choose Option D, attempting to filter logs via exclusion sinks, but this is often less efficient or incorrect because it doesn't prevent the initial collection/ingestion overhead at the source as effectively as changing the cluster logging mode.
Expert Analysis
Why the Answer Is Correct
Option A is correct because setting--logging=SYSTEM instructs GKE to stop sending application (workload) logs to Cloud Logging while continuing to send system logs (such as node, control plane, and Kubernetes system logs). Since developers use kubectl logs directly from the nodes, they can still access application logs locally without incurring Cloud Logging storage and ingestion costs for those verbose outputs. This directly addresses the requirement to minimize costs while collecting GKE operational logs.Why the Other Options Are Wrong
Option B (--logging=WORKLOAD) would disable system logs and enable only workload logs, which increases costs due to the verbose application logs mentioned in the scenario. Option C disables the default sink entirely, which would also drop critical system logs needed for operations. Option D attempts to filter logs using an exclusion rule; however, filtering at the sink level occurs after logs are ingested, meaning you still pay for ingestion and analysis of the unwanted logs, whereas Option A prevents them from being sent to Cloud Logging in the first place.Community Comment Notes
Community consensus strongly favors Option A. As user 'cachopo' noted, "The --logging=SYSTEM option disables workload logging... while keeping GKE system logs." Another commenter, 'BlackCoffee', highlighted that "exclusion filters are evaluated at the log router level," implying higher overhead compared to source-level configuration. User 'GP123123' initially debated A vs D but acknowledged the official guidance on available logs supports the SYSTEM approach for operational needs.Official Reference
https://cloud.google.com/kubernetes-engine/docs/concepts/about-logs#available-logs
This link opens the official vendor documentation in a new tab.
Exam Strategy
Always distinguish between preventing log generation/collection (source-level config like --logging=SYSTEM) versus filtering logs after ingestion (sink-level exclusions). Source-level prevention is typically more cost-effective for high-volume noisy logs.
Frequently Asked Questions
Why not use an exclusion filter instead of changing the logging mode?
Does --logging=SYSTEM affect developer ability to view logs?
kubectl logs to view application logs directly from the GKE nodes, as these logs remain on the local filesystem even if not exported to Cloud Logging.Discussion 14 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 14
-
Jason_Cloud_at 👍 4 Answered Dright answer
-
GP123123 👍 3 Answered AI am torn between A and D. With D's approach, in addition to DEBUG, messages such as INFO and WARNING may also be retained. For option A, the question does not explicitly define what operational logs should include. According to https://cloud.google.com/kubernetes-engine/docs/concepts/about-logs#available-logs, in addition to System and Workloads, there should also be API server, Scheduler, and Controller manager. Considering the lowest cost and the ability to view logs via kubectl, I ultimately chose option A.
-
cachopo 👍 3 Answered A
- The --logging=SYSTEM option disables workload logging (application logs) while keeping GKE system logs (like node, control plane, and Kubernetes system logs). - This helps reduce costs by not storing verbose application logs while still collecting critical GKE operational logs for monitoring. - Since developers use kubectl logs, they can still see logs without needing Cloud Logging.
-
lelele2023 👍 3 Answered DD The idea is to prevent/minimize container logs from getting sent to the sink,
-
asdasdfczxhjkvz 👍 2 Answered AA is correct
Show 9 more comments
-
xhilmi 👍 1 Answered DTo minimize costs associated with application logging in Google Kubernetes Engine (GKE) while still collecting operational logs, the recommended approach is (option D). Add the severity >= DEBUG resource.type = "k8s_container" exclusion filter to the _Default logging sink in the project associated with the development environment. This filter excludes logs with a severity level of DEBUG or lower for the specified resource type, "k8s_container," effectively reducing the volume of verbose application logs being ingested into Cloud Logging. This allows you to focus on collecting GKE operational logs while excluding less critical and potentially costly application logs. It helps strike a balance between maintaining visibility into operational aspects and optimizing costs associated with log storage and processing.
-
cachopo 👍 1Why not the other options? B. --logging=WORKLOAD disables system logs but keeps workload logs (application logs). - This increases costs because verbose application logs continue being collected in Cloud Logging. C. - This completely disables all logging, including GKE system logs, which is not recommended because operational logs are needed for debugging and monitoring. D. - This filters logs based on severity but still keeps some workload logs, not fully disabling application logging. - Also, not all logs use severity labels, so some logs may still be ingested, leading to unnecessary costs.
-
SahandJ 👍 1I just realised I completely misunderstood the question. For some reason I had the notion in my head that the Developers were to migrate to Cloud Logging as well and that not only do we need to minimize cost, but also remove redundant logs (like system logs) in Cloud Logging. However, obviously, the only requirement is to minimize costs for cloud logging. The devs are already reading the logs directly using kubectl. As such we want to remove as much logging as possible from the _Default bucket. Therefore (D) is the correct answer!
-
SahandJ 👍 1 Answered BNot sure I agree with any answers. But I disagree the least with A. A) Would send all the logs, including memory, CPU, and other system information. This is too verbose. B) WORKLOAD logs should be sufficient I believe C) Not sure disabling _Default helps here D) An exclusion filter of "severity >= DEBUG..." would literally exclude all logs?
-
BlackCoffee 👍 1 Answered AD is incorrect exclusion filters are evaluated at the log router level. Depending on your configuration, you may still incur log ingestion analysis overhead, and managing filters is more complex and prone to errors than simply telling GKE not to send application logs at the cluster level.
-
cachopo 👍 1By choosing A, you ensure that GKE system logs are collected while stopping application logs from being stored, minimizing logging costs without impacting developers' ability to use kubectl logs
-
lelele2023 👍 1C is invalid since a valid gcloud CLI will be: gcloud logging settings update --folder=FOLDER_ID--disable-default-sink https://cloud.google.com/logging/docs/default-settings#disable-default-sink
-
Luu13 👍 1If the filter in the exclusion filter is for severity >= DEBUG... would not exclude severity >= DEBUG instead of severity <= DEBUG?
-
SahandJ 👍 1I meant to say that I disagree the least with B as my selected answer
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All PCDOE Questions
Access 75 questions with complete answers and detailed explanations.
View Full PCDOE Practice Test →