GCP Cloud Logging Logs: Platform, Application & Audit

Learn the key differences between Platform, Application, and Audit Logs in Google Cloud Logging, including when to use each type and how they work together for comprehensive observability and compliance.

When you run workloads on Google Cloud Platform, understanding GCP Cloud Logging logs becomes essential for maintaining visibility into your infrastructure, applications, and security posture. Google Cloud organizes logs into three distinct categories, each serving a different purpose and generated by different sources. These categories are Platform Logs, Application Logs, and Audit Logs. Knowing which type of log captures what information helps you troubleshoot issues faster, build better monitoring systems, and meet compliance requirements.

The three log types exist because they address fundamentally different questions. Platform Logs tell you what your cloud resources are doing. Application Logs tell you what your code is doing. Audit Logs tell you who did what and when. Each category has its own generation mechanism, retention characteristics, and typical use cases. While they all flow through Cloud Logging, they serve distinct operational needs.

Understanding the Three Categories of GCP Cloud Logging Logs

Before diving into each type, it helps to understand the organizing principle. The distinction between these log categories comes down to their source and purpose. Platform Logs are automatically generated by Google Cloud services themselves. Application Logs are explicitly written by your application code. Audit Logs are automatically created by GCP to record administrative activities and data access patterns.

These categories are not mutually exclusive in practice. A single application running on Google Cloud generates all three types simultaneously. A Cloud Run service produces Platform Logs about container health, Application Logs from your code's print statements, and Audit Logs when someone updates the service configuration. Understanding each category helps you know where to look when investigating different types of problems.

Platform Logs: Resource Health and Service Operations

Platform Logs come directly from Google Cloud services and show you how your infrastructure resources are performing. These logs are generated automatically by the cloud platform without any action required from your application code. They capture information about resource lifecycle events, health checks, scaling activities, and service-level operations.

When a Compute Engine instance starts up, Platform Logs record that boot sequence. When a Cloud SQL database performs an automatic backup, Platform Logs capture that activity. When a load balancer distributes traffic across backend instances, Platform Logs document those routing decisions. This category provides visibility into the infrastructure layer that supports your applications.

Common Sources of Platform Logs

Different Google Cloud services generate Platform Logs with varying levels of detail. Cloud Load Balancing produces logs for every request it handles, including client IP addresses, latency measurements, and backend selection. Cloud SQL generates logs about database operations, connection attempts, and performance metrics. Google Kubernetes Engine creates logs about cluster operations, node health, and pod scheduling decisions.

Consider a video streaming service running on GKE. The Platform Logs from their Kubernetes cluster show when nodes are added to handle increased load, when pods are evicted due to resource pressure, and when the cluster autoscaler makes scaling decisions. These logs help the infrastructure team understand cluster behavior without requiring any logging code in the streaming application itself.

When to Use Platform Logs

Platform Logs are your primary tool for infrastructure troubleshooting and capacity planning. When users report that your application is slow, Platform Logs help you determine whether the problem stems from compute resources, network latency, or database performance. When planning scaling strategies, these logs reveal patterns in resource utilization and traffic distribution.

A solar farm monitoring company uses Platform Logs from their Cloud IoT Core deployment to track device connections and message delivery rates. When sensor data stops flowing from a particular solar array, Platform Logs reveal whether the issue is a failed device connection or a problem with the message routing infrastructure. The application code never sees these connection-level details, but Platform Logs make them visible.

Accessing Platform Logs in GCP

Platform Logs appear in the Cloud Logging interface under resource-specific categories. To view logs for a particular Compute Engine instance, you filter by resource type gce_instance. For Cloud Run services, you filter by cloud_run_revision. The Logs Explorer in the Google Cloud Console provides filters to narrow down to specific resource types and instances.

You can query Platform Logs using the Logging query language. A query like this retrieves load balancer logs showing high latency:


resource.type="http_load_balancer"
jsonPayload.latency > 1.0

Platform Logs are retained according to the default retention period for your project, typically 30 days, though you can configure longer retention or export logs to Cloud Storage for archival purposes.

Application Logs: Your Code's Output

Application Logs are the logs that your own code generates. When your Python service writes to stdout, when your Java application calls a logging framework, or when your Node.js function uses console.log, those outputs become Application Logs in Cloud Logging. This category gives you visibility into application-level events, business logic execution, and custom metrics that only your code understands.

Application Logs are where you track user actions, record business events, log error conditions, and output debugging information. They reflect the specific concerns of your application domain. A payment processor logs transaction attempts and results. A genomics analysis platform logs job submissions and completion statuses. A mobile game backend logs player authentication events and match outcomes.

Structured vs Unstructured Application Logs

Application Logs can be unstructured text strings or structured JSON objects. Unstructured logs are simple but harder to query and analyze. A log line like "User login failed" is easy to write but provides limited filtering capabilities. Structured logs use JSON format to include multiple fields, making them much more powerful for analysis.

A subscription box service might generate structured Application Logs like this from their order processing service:


{
  "severity": "INFO",
  "message": "Order processed successfully",
  "orderId": "ORD-2847392",
  "customerId": "CUST-48291",
  "boxType": "premium",
  "processingTimeMs": 245,
  "timestamp": "2024-01-15T14:32:18Z"
}

This structure allows querying for all orders of a specific box type, filtering by processing time, or analyzing patterns for individual customers. The same information in an unstructured log would be much harder to extract and analyze.

Logging Libraries and Integration

Google Cloud provides client libraries that integrate with Cloud Logging across different programming languages. The Python logging library automatically forwards logs to Cloud Logging when running on Google Cloud services. The Java library integrates with popular frameworks like Log4j and SLF4J. Node.js applications can use the winston logging library with Cloud Logging transport.

A telehealth platform running on Cloud Run might use the Python logging integration like this:


import logging
import google.cloud.logging

client = google.cloud.logging.Client()
client.setup_logging()

logger = logging.getLogger(__name__)

def schedule_appointment(patient_id, provider_id, time_slot):
    logger.info(
        "Appointment scheduled",
        extra={
            "patient_id": patient_id,
            "provider_id": provider_id,
            "appointment_time": time_slot,
            "booking_method": "mobile_app"
        }
    )

This code automatically sends structured logs to Cloud Logging, where they can be queried and analyzed alongside Platform and Audit Logs.

When to Use Application Logs

Application Logs are your tool for understanding application behavior and debugging code-level issues. When a user reports unexpected behavior, Application Logs help you trace the execution path and identify where logic diverged from expectations. When monitoring business metrics, Application Logs provide the raw data about events that matter to your domain.

A freight logistics company uses Application Logs to track shipment state transitions. When a package moves from "in transit" to "out for delivery," their routing service writes an Application Log with shipment details, driver assignment, and estimated delivery time. These logs feed into their real-time tracking dashboard and help customer service representatives answer delivery inquiries. No Platform Log would capture this business-specific information because it exists only in the application's domain model.

Audit Logs: Security and Compliance Records

Audit Logs in Google Cloud automatically record who performed what actions on which resources. These logs are generated by the GCP platform itself, but unlike Platform Logs that focus on resource health, Audit Logs focus on security and governance. They answer questions about access, changes, and data interactions across your cloud environment.

Audit Logs are essential for compliance requirements, security investigations, and understanding changes to your cloud infrastructure. When someone deletes a Cloud Storage bucket, Audit Logs record who did it and when. When a service account accesses sensitive data in BigQuery, Audit Logs capture that access. When configuration changes are made to a Cloud SQL instance, Audit Logs document those modifications.

Types of Audit Logs

Google Cloud Platform provides three types of Audit Logs, each capturing different categories of activity. Admin Activity audit logs record administrative actions like creating a virtual machine, changing IAM policies, or deleting a dataset. These logs are always enabled and retained for 400 days at no charge.

Data Access audit logs record operations that read or modify user data. When a query reads from a BigQuery table, when a user downloads a file from Cloud Storage, or when an application reads records from Firestore, Data Access audit logs capture those operations. These logs can generate significant volume and are disabled by default for many services to control costs.

System Event audit logs record Google Cloud administrative actions that modify your resource configurations. These are actions taken by Google Cloud systems rather than users, such as automatic instance migrations or system-initiated maintenance operations.

Audit Logs in Practice

A hospital network using GCP for patient records relies heavily on Audit Logs for HIPAA compliance. They enable Data Access audit logs for their Cloud Storage buckets containing medical imaging and their BigQuery datasets with patient information. When a physician views patient records, when a researcher queries anonymized datasets, or when backup systems access patient data, Audit Logs create a complete trail of data access.

During a compliance audit, the hospital can demonstrate exactly who accessed specific patient records, when those accesses occurred, and from what IP addresses. They can prove that only authorized personnel with appropriate roles accessed sensitive health information. This audit trail is generated automatically by GCP without requiring any logging code in their applications.

Configuring and Accessing Audit Logs

Admin Activity and System Event audit logs are enabled by default across all Google Cloud services. Data Access audit logs require explicit configuration through IAM audit configuration policies. You enable them per service and can specify which data access operations to log.

To enable Data Access audit logs for BigQuery, you would modify your project's IAM policy to include an audit config like this:


{
  "auditConfigs": [
    {
      "service": "bigquery.googleapis.com",
      "auditLogConfigs": [
        {
          "logType": "DATA_READ"
        },
        {
          "logType": "DATA_WRITE"
        }
      ]
    }
  ]
}

Audit Logs appear in Cloud Logging with resource types that identify their source service. You can filter for audit logs using queries like:


logName="projects/your-project/logs/cloudaudit.googleapis.com%2Factivity"
protoPayload.methodName="storage.buckets.delete"

This query finds all Admin Activity audit logs recording Cloud Storage bucket deletions.

When to Use Audit Logs

Audit Logs serve security, compliance, and forensic needs. When investigating a security incident, Audit Logs help you reconstruct what happened and identify the scope of unauthorized access. When demonstrating compliance with regulations like GDPR, HIPAA, or SOC 2, Audit Logs provide evidence of proper access controls and data handling.

A financial services company running a trading platform on GCP uses Audit Logs to track all changes to their production infrastructure. When a Cloud Functions deployment occurs outside normal change windows, Audit Logs immediately reveal who deployed it and from what source. When investigating unusual database query patterns, Data Access audit logs show exactly which service accounts executed queries against sensitive trading data. This visibility is critical for both security and regulatory compliance in financial services.

How These Log Types Appear in Cloud Logging

All three categories of GCP Cloud Logging logs flow into the same centralized Cloud Logging system, but they remain distinct and identifiable. In the Logs Explorer, you can filter by log type to focus on the category relevant to your investigation. Platform Logs typically have resource-specific log names, Application Logs often appear under stdout or stderr streams, and Audit Logs have standardized names under the cloudaudit.googleapis.com namespace.

A climate modeling research organization runs complex simulations on Compute Engine with custom analysis code. When investigating why a simulation job failed, they examine all three log types. Platform Logs from Compute Engine show that the instance experienced high memory pressure. Application Logs from their simulation code reveal which calculation stage was executing when the failure occurred. Audit Logs show that no one made configuration changes to the instance during the failure window, ruling out administrative actions as a cause.

This multi-layered visibility demonstrates why understanding all three categories matters. Each provides a different perspective on the same system, and effective troubleshooting often requires correlating information across log types.

Comparing the Three Log Categories

The table below summarizes the key differences between Platform, Application, and Audit Logs in Google Cloud:

CharacteristicPlatform LogsApplication LogsAudit Logs
SourceGoogle Cloud servicesYour application codeGCP platform (automatic)
PurposeResource health and operationsApplication events and debuggingSecurity and compliance tracking
GenerationAutomatic by GCP servicesExplicit via logging librariesAutomatic by GCP platform
ConfigurationEnabled by defaultRequires code implementationAdmin/System enabled by default, Data Access requires configuration
Common Use CasesInfrastructure troubleshooting, capacity planningApplication debugging, business event trackingSecurity investigations, compliance reporting
Default Retention30 days30 days400 days (Admin Activity), 30 days (Data Access)
ExamplesLoad balancer requests, VM lifecycle events, database backupsUser login attempts, order processing, custom metricsIAM policy changes, data access events, resource deletions

Understanding these differences helps you know where to look for specific information. When troubleshooting application logic, start with Application Logs. When investigating infrastructure performance, examine Platform Logs. When responding to security incidents or compliance requests, turn to Audit Logs.

Relationships Between Log Categories

These three log categories form complementary layers of observability. They are not alternatives where you choose one over another. Instead, comprehensive visibility requires all three working together. A well-instrumented Google Cloud environment generates all three types of logs simultaneously.

Platform Logs and Application Logs often need correlation during troubleshooting. An ISP running network monitoring tools on GKE might see elevated error rates in Application Logs. Correlating those errors with Platform Logs reveals that pod evictions were occurring due to resource constraints at the same time. Neither log category alone tells the complete story.

Application Logs and Audit Logs sometimes overlap in what they record but serve different purposes. An online learning platform might log user authentication attempts in their Application Logs for debugging purposes. The same authentication events also appear in Audit Logs as IAM policy evaluations. The Application Logs help developers debug authentication logic. The Audit Logs help security teams track access patterns and meet compliance requirements. Both perspectives have value.

A common pattern is to use Audit Logs as triggers for deeper investigation using other log types. When Audit Logs show an unexpected IAM policy change, you examine Platform Logs to see if that change affected resource behavior and Application Logs to determine if applications responded with errors.

Practical Guidance for Log Management

Managing these three categories effectively requires different strategies for each type. For Platform Logs, focus on identifying which services and resource types generate the highest volume and ensure you understand their log schemas. Cloud Load Balancing can generate massive log volumes in high-traffic environments. Consider sampling these logs or excluding health check requests to control costs while maintaining visibility into real traffic.

For Application Logs, establish structured logging standards across your development teams. Consistent field names, severity levels, and context inclusion make logs far more useful. A mobile game studio might standardize on including player_id, session_id, and game_version in every Application Log entry. This consistency enables powerful cross-session analysis and player experience debugging.

For Audit Logs, carefully consider which Data Access audit logs to enable. These logs can generate significant volume and cost, especially for high-traffic data services like BigQuery or Cloud Storage. Enable Data Access logging selectively for sensitive datasets rather than organization-wide. A public health department might enable Data Access logs only for datasets containing personally identifiable information, not for public statistical datasets.

Export and Retention Strategies

All three log types benefit from export strategies that extend retention beyond default periods and enable advanced analysis. You can configure log sinks to export logs to Cloud Storage for long-term archival, to BigQuery for SQL analysis, or to Pub/Sub for real-time processing.

An esports platform exports all three log types to BigQuery for analysis. They query Platform Logs to understand infrastructure scaling patterns during major tournaments. They analyze Application Logs to track player matchmaking latency and game server performance. They use Audit Logs to investigate suspicious account activity and demonstrate compliance with data protection regulations. Having all three types in BigQuery enables joining across log categories for comprehensive analysis.

Relevance to Google Cloud Certification

Understanding the differences between Platform, Application, and Audit Logs is relevant for several Google Cloud certifications, particularly the Professional Cloud Architect and Professional Cloud Security Engineer exams. These exams test your ability to design monitoring and logging strategies, implement security controls, and meet compliance requirements.

Exam questions might present scenarios where you need to identify which log type provides the information needed to solve a specific problem. You might be asked about configuring Data Access audit logs for compliance requirements, or about correlating Platform and Application Logs during incident response. Understanding the characteristics and use cases for each log category helps you answer these questions accurately.

Making Informed Logging Decisions

The three categories of GCP Cloud Logging logs exist because they serve fundamentally different purposes. Platform Logs give you visibility into your infrastructure without requiring any code. Application Logs let you instrument your code with domain-specific information that only your application understands. Audit Logs provide automated security and compliance tracking across your entire Google Cloud environment.

Effective use of Cloud Logging means understanding all three categories and using each for its intended purpose. When you need to debug why a service is throwing errors, start with Application Logs. When you need to understand why that service is experiencing high latency, examine Platform Logs. When you need to demonstrate who has accessed sensitive data, turn to Audit Logs. These are not competing alternatives but complementary tools that together provide comprehensive visibility into your cloud operations.