Welcome to the Elasticsearch ASP.NET Core microservice! This microservice is designed to provide logging functionality using Serilog with Elasticsearch support. It includes endpoints to log messages and audit events, along with configuration for Elasticsearch sink.
-
Logging Endpoints:
- The
LoggerController
provides endpoints to log messages and audit events.
- The
-
Elasticsearch Support:
- Configured with Serilog to support Elasticsearch sink.
- Utilizes AutoMapper for mapping log levels between ASP.NET Core and Elasticsearch.
-
Configuration:
- Reads configuration from
appsettings.json
and environment-specific settings. - Elasticsearch is configured with the URI specified in
ElasticConfiguration
inappsettings.json
.
- Reads configuration from
-
Configure Elasticsearch:
- Set up Elasticsearch and update the Elasticsearch URI in
appsettings.json
(ElasticConfiguration:Uri
).
- Set up Elasticsearch and update the Elasticsearch URI in
-
Run the Microservice:
- Execute the
Main
method in theProgram.cs
file.
- Execute the
-
Log Messages:
- Use the
/api/logger/log
endpoint to log messages. - Use the
/api/logger/logaudit
endpoint to log audit events.
- Use the
-
Observe Elasticsearch:
- Check your configured Elasticsearch instance for logs and audit events.
- Configure Elasticsearch URI in
appsettings.json
(ElasticConfiguration:Uri
). - Update the log index format in
ConfigureElasticSink
method.
"ElasticConfiguration": {
"Uri": "http://localhost:9200"
},
- Serilog
- Elasticsearch Sink for Serilog
- AutoMapper
- Audit.Net
Explore and utilize this Elasticsearch ASP.NET Core microservice for efficient logging with Elasticsearch support!