Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better support for Serilog.Settings.Configuration #441

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Sep 16, 2024

Elasticsearch appsettings configuration

When configuring through appsettings only the bootstrapMethod configuration is required

{
  "Serilog": {
    "Using": [ "Elastic.Serilog.Sinks" ],
    "MinimumLevel": { "Default": "Information" },
    "WriteTo": [
      {
        "Name": "Elasticsearch",
        "Args": {
          "bootstrapMethod": "Silent",
          "nodes": [ "http://elastichost:9200" ],
          "useSniffing": true,
          "apiKey": "<apiKey>",
          "username": "<username>",
          "password": "<password>",

          "ilmPolicy" : "my-policy",
          "dataStream" : "logs-dotnet-default",
          "includeHost" : true,
          "includeUser" : true,
          "includeProcess" : true,
          "includeActivity" : true,
          "filterProperties" : [ "prop1", "prop2" ],
          "proxy": "http://localhost:8200",
          "proxyUsername": "x",
          "proxyPassword": "y",
          "debugMode": false,

          //EXPERT settings, do not set unless you need to 
          "maxRetries": 3,
          "maxConcurrency": 20,
          "maxInflight": 100000,
          "maxExportSize": 1000,
          "maxLifeTime": "00:00:05",
          "fullMode": "Wait"
        }
      }
    ]
  }
}

Elastic Cloud appsettings configuration

When configuring through appsettings only the bootstrapMethod configuration is required

You can specify either endpoint or cloudId, cloudId will take precedence.

You'll need to specify either apiKey or username and password.

{
  "Serilog": {
    "Using": [ "Elastic.Serilog.Sinks" ],
    "MinimumLevel": { "Default": "Information" },
    "WriteTo": [
      {
        "Name": "ElasticCloud",
        "Args": {
          "bootstrapMethod": "Silent",
          "endpoint": "https://<redacted>.es.us-central1.gcp.cloud.es.io",
          "cloudId": "<cloudId>",
          "apiKey": "<apiKey>",
          "username": "<username>",
          "password": "<password>",

          "ilmPolicy" : "my-policy",
          "dataStream" : "logs-dotnet-default",
          "includeHost" : true,
          "includeUser" : true,
          "includeProcess" : true,
          "includeActivity" : true,
          "filterProperties" : [ "prop1", "prop2" ],
          "proxy": "http://localhost:8200",
          "proxyUsername": "x",
          "proxyPassword": "y",
          "debugMode": false,

          //EXPERT settings, do not set unless you need to 
          "maxRetries": 3,
          "maxConcurrency": 20,
          "maxInflight": 100000,
          "maxExportSize": 1000,
          "maxLifeTime": "00:00:05",
          "fullMode": "Wait"
        }
      }
    ]
  }
}

Copy link
Contributor

@stevejgordon stevejgordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mpdreamz Mpdreamz merged commit 2f9d18c into main Sep 18, 2024
7 checks passed
@Mpdreamz Mpdreamz deleted the feature/serilog-json-configuration branch September 18, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Enable full configuration of Elastic.Serilog.Sinks through appsettings.json
2 participants