Log.Logger = new LoggerConfiguration()
...
.WriteTo.BigQuery("my-gcp-project-id")
.CreateLogger();
Also with IConfiguration
Log.Logger = new LoggerConfiguration()
...
.WriteTo.BigQuery(configuration.GetSection("BigQuery"))
.CreateLogger();
appsettings.json
{
"BigQuery": {
"ProjectId": "my-gcp-project-id",
"DatasetName": "mydataset"
}
}
The BigQuery table has the following structure.
Field name | Type |
---|---|
Time | STRING |
LevelNumber | INTEGER |
LevelName | STRING |
Message | STRING |
Template | STRING |
Properties | RECORD (REPEATED) |
Properties. Name | STRING |
Properties. Value | STRING |
ExceptionStackTrace | STRING |
The properties name column could have "." for nested properties in the form of "RootProperty.ChildProperty".
Required Roles/Permissions:
- BigQuery Data Editor
- BigQuery User