Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samhammerag/samhammer.logging.logstash
Logstash for .NET Core projects
https://github.com/samhammerag/samhammer.logging.logstash
net-core-project-lib serilog
Last synced: 23 days ago
JSON representation
Logstash for .NET Core projects
- Host: GitHub
- URL: https://github.com/samhammerag/samhammer.logging.logstash
- Owner: SamhammerAG
- License: mit
- Created: 2020-02-14T12:39:20.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-07T11:44:45.000Z (10 months ago)
- Last Synced: 2024-11-14T11:42:35.568Z (about 1 month ago)
- Topics: net-core-project-lib, serilog
- Language: C#
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Samhammer.Logging.Logstash
## Usage
This package is a implementation of the serilog http sink https://github.com/FantasticFiasco/serilog-sinks-http to use logstash.#### How to add this to your project:
- reference this package to your project: https://www.nuget.org/packages/Samhammer.Logging.Logstash/
- call WriteToLogstash on the LoggerConfiguration from Serilog
- add the logstash configuration to the appsettings#### Example:
```csharp
public static void ConfigureLogger(HostBuilderContext context, LoggerConfiguration logger)
{
var elasticIndexPlaceholders = new Dictionary
{
{ "{environment}", context.HostingEnvironment.EnvironmentName },
};
logger.WriteTo.Logstash(context.Configuration, elasticIndexPlaceholders)
}
```#### Example appsettings configuration:
```json
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning",
"HealthChecks.UI": "Fatal"
}
},
"Logstash": {
"Url": "",
"UserName": "",
"Password": "",
"ElasticIndex": ""
}
},
```#### Example elastic index template:
```
projectname-{environment}-{brand}
```
The placeholders in the elastic index template will be replaced with the values of the placeholders dictionary.## Contribute
#### How to publish package
- Create a tag and let the github action do the publishing for you