ASP.NET Core logging and monitoring demo, based the default ASP.NET Core Web Application template from .NET 5.0, using Docker and docker-compose to put it all together. This solution is, de-facto, a boilerplate for the full-blown logging and monitoring solution.
It consists of two main parts:
-
Logging (ELK stack):
- Serilog plus various additional Serilog packages, using Serilog.Sinks.Http to send the data to Logstash via durable HTTP with batching and rolling file buffers
- Logstash to ingest and filter the logs
- Elasticsearch to index the logs and provide searching capabilities
- Kibana to visualize the logs
-
Monitoring:
- Prometheus, including Prometheus Pushgateway, to collect and process all metrics
- prometheus-net and prometheus-net.DotNetRuntime to collect ASP.NET Core and .NET Runtime-related metrics from the main container and to send them to Prometheus
- Grafana with various predefined dashboards to visualize the metrics
- cAdvisor to provide an understanding of the resource usage and performance characteristics of all running containers
- Node Exporter to expose hardware and OS metrics
- Alertmanager as the alerting system (no real configuration in the demo, just a blackhole receiver)
Also, it includes ASP.NET Core Health Checks based on AspNetCore.Diagnostics.HealthChecks and related packages. It is used to provided health checks for some internal metrics like memory consumption and for liveness of all the services. Also, it exposes a user interface for health checks on the main container.
docker-compose up
or open /MonitoringDemo.sln
in Visual Studio and run it as usual.