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
LoggerControllerprovides 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.jsonand environment-specific settings. - Elasticsearch is configured with the URI specified in
ElasticConfigurationinappsettings.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
Mainmethod in theProgram.csfile.
- Execute the
-
Log Messages:
- Use the
/api/logger/logendpoint to log messages. - Use the
/api/logger/logauditendpoint 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
ConfigureElasticSinkmethod.
"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!