> ## Documentation Index
> Fetch the complete documentation index at: https://docs.idun-group.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Cloud Logging

> Set up Google Cloud Logging to capture structured logs from your agents.

Set up Google Cloud Logging to send structured logs from your agents to Google Cloud for centralized log management.

<Tip>
  Before starting, complete the [quickstart guide](/quickstart) to have an agent running on Idun Engine.
</Tip>

## Set up GCP Logging observability

<Steps>
  <Step title="Prepare your Google Cloud project">
    1. Create a Google Cloud project if you do not have one
    2. Enable the **Cloud Logging API** in your project
    3. Verify that the environment where your agent runs has credentials with permission to write logs (the `Logs Writer` role)
  </Step>

  <Step title="Configure GCP Logging in the standalone">
    Open the running standalone at `/admin/observability/` and click **GCP Logging**. Fill in:

    * **GCP project ID**: Your Google Cloud project ID
    * **Region**: (Optional) Region/zone associated with the resource (e.g., `us-central1`)
    * **Log name**: Identifier for the log stream (e.g., `application-log`)
    * **Resource type**: Resource type label (e.g., `global`, `gce_instance`, `cloud_run_revision`)
    * **Severity**: Minimum level to record (`INFO`, `WARNING`, `ERROR`, `CRITICAL`)

    <Frame>
      <img src="https://mintcdn.com/idunlabs/SjVPzIbyPaldjUKK/images/ui/admin-observability-gcp-logging.png?fit=max&auto=format&n=SjVPzIbyPaldjUKK&q=85&s=219fb01f97fb02fc8303a600c9487f4b" alt="Observability admin page with GCP Logging selected" width="1911" height="1040" data-path="images/ui/admin-observability-gcp-logging.png" />
    </Frame>

    Save the form. The reload pipeline re-instantiates the engine with the new observability config; subsequent agent runs ship structured logs to GCP.
  </Step>
</Steps>

Alternatively, configure GCP Logging in your `config.yaml` for first-boot seeding or engine-only mode:

```yaml config.yaml theme={"theme":{"light":"github-light","dark":"github-dark"}}
observability:
  - provider: "GCP_LOGGING"
    enabled: true
    config:
      project_id: "my-gcp-project"
      log_name: "idun-agent-logs"
      resource_type: "cloud_run_revision"
      severity: "INFO"
```

## View log data

Once your agent is running with observability enabled:

1. Interact with your agent through the chat UI at `/` or the API at `/agent/run`
2. Open the [Google Cloud Console](https://console.cloud.google.com/)
3. Navigate to **Logging** > **Logs Explorer**

Filter by the **Log Name** you configured to see your agent's logs.

## Best practices

* **Use structured logging**: The agent platform sends structured logs, which are easier to query in GCP
* **Set appropriate severity**: Filter out debug noise in production by setting severity to `INFO` or `WARNING`

## Troubleshooting

<AccordionGroup>
  <Accordion title="Logs not showing up?">
    1. **Check permissions**: Verify the `Logs Writer` role is assigned to the agent's service account
    2. **Check log name**: Confirm you are filtering by the correct log name in Logs Explorer
  </Accordion>
</AccordionGroup>

## Next steps

<Card title="GCP Trace" icon="route" horizontal href="/observability/gcp-trace">
  Add distributed tracing alongside structured logs in Google Cloud.
</Card>

<Card title="Local trace store" icon="database" horizontal href="/observability/traces">
  See the same agent runs in the bundled admin UI without GCP setup.
</Card>

<Card title="Deploy to Cloud Run" icon="cloud" horizontal href="/standalone/cloud-run">
  Run the standalone next to your logs with managed Postgres.
</Card>
