everything you need to ship logs from fly.io app instances to GCP, S3, or BetterStack (basically https://github.com/superfly/fly-log-shipper but with the configurations I prefer)
Use gcloud command line to...
- Create a new logging bucket that will eventually store logs
gcloud logging buckets create my-new-logs-bucket --location=global --retention-days=180 --description="some description"
- Create a new logging sink that will receive the logs from the shipper and write them to the bucket
gcloud logging sinks create my-new-log-sink my-new-logs-bucket [--description=DESCRIPTION] --project=PROJECT_ID
- Create a new service account user
gcloud iam service-accounts create your-service-user-name --description="DESCRIPTION" --display-name="DISPLAY_NAME"
- Create service account credentials for the user, and prepare to ship those in this docker container
gcloud iam service-accounts keys create ./gcp_logging_user_credentials.json --iam-account=your-service-user-name@your-project.iam.gserviceaccount.com
- Grant the service account the ability to write logs
gcloud projects add-iam-policy-binding PROJECT_ID --member=serviceAccount:your-service-user-name@PROJECT_ID.iam.gserviceaccount.com --role=roles/logging.logWriter
Then bake the credentials file in the docker container, set your GOOGLE_CREDNETIALS env var, and deploy