Sep 2017




Serilog is a great logging library for .NET that outputs structured logs to various sinks. Google Cloud Logging (previously known as Stackdriver) is a popular logging service that supports structured formats along with integrated error reporting, monitoring, forwarding, and archiving to cloud storage.

I released Serilog.Sinks.GoogleCloudLogging as a new sink to integrate with GCP using the native Logging API to send log events. All contextual data and properties from Serilog are included and can be used to filter and group logs in the viewer.

The underlying GoogleCloudDotnet libraries use the Default Application Credentials and automatically retrieve config for most GCP environments (App Engine, GCE, GKE, and Cloud Run) for easy deployment. See more details in the readme.

dotnet add package Serilog.Sinks.GoogleCloudLogging
var config = new GoogleCloudLoggingSinkOptions { ProjectId = "YOUR_PROJECT_ID" };
Log.Logger = new LoggerConfiguration().WriteTo.GoogleCloudLogging(config).CreateLogger();