Google Run logging

Start logging in 10 minutes

Ship your Google Run runtime logs to Better Stack using a Vector sidecar container.

Create Better Stack Vector source

  1. Go to Better Stack → SourcesConnect source.
  2. Name your source and select Vector from the Logs + Metrics section.
  3. Keep this tab open. You’ll need the Source token and Ingesting host later.

Create Google Run volume

  1. Navigate to Google CloudGoogle Run.
  2. Open configuration for your Service or Job.
  3. Create volume of any type.

google_run_volumes.png

All logs will be written to this volume. The Better Stack sidecar container will read the logs from the volume and ship them our way.

Mount the volume and add the Better Stack sidecar container

Attach the volume to both your main container and the Better Stack sidecar container, and configure the sidecar.

  1. Mount volume to main container
    • Navigate to Containers tab -> Volume mounts tab.
    • Click Mount volume and choose the volume you created.
    • Type in Mount path – e.g., shared-volume/logs.
  2. Add Better Stack sidecar container
    • Scroll down and select Add container
    • Fill in Container image URL: registry-1.docker.io/betterstack/google-run-vector:amd64-latest
  3. Configure startup probe
    • Stay in Settings tab.
    • Set Startup probePort: 8686.
  4. Add environment variables

    In Variables & secrets, add the following variables:

    Environment variables
    BETTER_STACK_SOURCE_TOKEN=$SOURCE_TOKEN
    BETTER_STACK_INGESTING_HOST=$INGESTING_HOST
    BETTER_STACK_LOG_PATH=shared-volume/logs/*.log
    
  5. Mount volume to sidecar container

    • Click Volume mounts tab -> Mount volume.
    • Select the volume you created.
    • Fill in Mount path – e.g., shared-volume/logs.

google_run_mount_container.png

Write logs to the shared volume

Make sure your main container writes logs to the mounted volume – e.g., shared-volume/logs/app.log.

You should see your logs in Better Stack → Live tail.

Need help?

Please let us know at hello@betterstack.com.   We're happy to help! 🙏