Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/murilobeltrame/aspnetgraylogsample
A simple project to showcase logging an ASP.Net Core application on Graylog
https://github.com/murilobeltrame/aspnetgraylogsample
aspnet aspnet-core aspnetcore docker docker-compose dotnet dotnet-core dotnetcore graylog mvc
Last synced: about 2 months ago
JSON representation
A simple project to showcase logging an ASP.Net Core application on Graylog
- Host: GitHub
- URL: https://github.com/murilobeltrame/aspnetgraylogsample
- Owner: murilobeltrame
- Created: 2018-08-08T01:31:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-13T16:35:44.000Z (over 6 years ago)
- Last Synced: 2024-04-28T05:51:46.573Z (8 months ago)
- Topics: aspnet, aspnet-core, aspnetcore, docker, docker-compose, dotnet, dotnet-core, dotnetcore, graylog, mvc
- Language: C#
- Size: 891 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# AspNetGraylogSample
This is a very simple sample showing how to log an ASP.Net Core on Graylog
## Summary
- [Requirements](#requirements)
- [Running](#running)
- [Dependencies](#dependencies)
- [Application](#application)
- [Logging ASP.Net Core](#logging-aspnet-core)
- [Exploring Graylog](#exploring-graylog)
- [References](#references)## Requirements
| Tool | Desc | Download |
| ---- | ---- | -------- |
| Docker | Specially to run the Compose to run up all the solution dependencies like Mongo, Graylog and Elastic Search | [https://store.docker.com/](https://store.docker.com/) |
| DotNet Core SDK | To run the sample application. You can optionally run the sample application on a container but you will need to deal with networking stuff | [https://www.microsoft.com/net/download](https://www.microsoft.com/net/download) |## Running
### Dependencies
Run dependencies means run all stack required for Graylog (MongoDb, ElasticSearch and Graylog itself).
By default, Graylog locks some host ports:| Ports | Desc |
| ----- | ---- |
| **9000** | Graylog web interface and REST API |
| **514** | Syslog TCP |
| **514/udp** | Syslog UDP |
| **12201** | GELF TCP |
| **12201/udp** | GELF UDP |To run the solution dependencies, run the following command on project root:
```sh
docker-compose up -d
```> The `-d` option is opitional and tells the command to run on background freeing up the terminal.
### Application
To run the sample application, just run the command
```sh
dotnet run -p ./SampleMVC
```> By default, the sample application locks the **5000** port on host.
## Logging ASP.Net Core
The sample applications uses the [Gelf.Extensions.Logging](https://www.nuget.org/packages/Gelf.Extensions.Logging/) library, that relyes on [Microsoft.Extensions.Logging](https://www.nuget.org/packages/Microsoft.Extensions.Logging/), enabling a very seamless integration to the application pipeline and enabling a very simple loggin implementation.
To log informations to Graylog just use the common pattern as described in the [ASP.Net Core Documentation](https://docs.microsoft.com/pt-br/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1).## Exploring Graylog
The view logged information on Graylog, just access the web interface.
By default, it should be running on `http://localhost:9000`.## References
- [https://hub.docker.com/r/graylog/graylog/](https://hub.docker.com/r/graylog/graylog/)
- [https://github.com/mattwcole/gelf-extensions-logging](https://github.com/mattwcole/gelf-extensions-logging)
- [https://docs.microsoft.com/pt-br/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1](https://docs.microsoft.com/pt-br/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1)