https://github.com/amccool/lib-eslogger
An implementation of ILogger that logs to Elastic Search.
https://github.com/amccool/lib-eslogger
Last synced: about 2 months ago
JSON representation
An implementation of ILogger that logs to Elastic Search.
- Host: GitHub
- URL: https://github.com/amccool/lib-eslogger
- Owner: amccool
- License: mit
- Created: 2018-02-17T17:19:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-01T20:16:32.000Z (over 5 years ago)
- Last Synced: 2025-02-03T11:09:58.601Z (4 months ago)
- Language: C#
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lib-eslogger
An implementation of ILogger that logs to Elastic Search. A large chunk of code was borrowed from [here](https://github.com/DaniJG/ELKLogging).See example for usage.
## Install
Install the nuget package `Outreach.ESLogger` or add a reference in your csproj and run `dotnet restore`.
```
```
## Usage
In `Startup.cs` put the using at the top.
```
using Outreach.ESLogger;
```Then configure it like so.
```
public void ConfigureServices(IServiceCollection services)
{
services.ConfigureESLogger(Configuration.GetSection("ElasticSearch"));
// The rest...
}public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"))
.AddDebug()
.AddESLogger(app.ApplicationServices, "log-");
// The rest...
}
```And be sure to have a section in your `appsettings.json` for `ElasticSearch`
```
{
"ElasticSearch": {
"Uri": "http://localhost:9200/",
"DefaultIndex": "default-",
"UserName": null,
"Password": null
}
}
```