GithubHelp home page GithubHelp logo

fantasticfiasco / serilog-sinks-http-sample-elastic-stack Goto Github PK

View Code? Open in Web Editor NEW
17.0 6.0 10.0 386 KB

Sample application of Serilog.Sinks.Http sending log events to Elastic Stack.

License: Apache License 2.0

C# 26.70% Shell 64.94% Dockerfile 8.36%
serilog elastic-stack logstash elasticsearch kibana elk serilog-sink dotnet

serilog-sinks-http-sample-elastic-stack's Introduction

Serilog and the Elastic Stack

Table of contents


Introduction

Elastic Stack is fantastic at collecting and visualizing log events. Serilog is fantastic at producing structured log events. This repository provides a sandbox where developers can explore the life of a log event starting with its birth in Serilog, its transport over the network to Logstash, its fields being indexed by Elasticsearch and finally its legacy being recorded as a historical event in Kibana.

What you will end up with

alt text

With a running Elastic Stack and Serilog producing log events you are now ready to take it to the next level. If you fancy the producing part you'll dig deeper into Serilog and its configuration of log contexts, enrichers and message formatters. If you enjoy monitoring applications in production you'll explore Kibana with its visualizations and dashboards.

Requirements

Usage

Bringing up Elastic Stack

Start the stack using docker:

cd .\elastic-stack\

# This command is only necessary the first time the stack is started
docker compose up setup

docker compose up

Publishing log events using Serilog

Run the following commands to publish log events to Logstash using Serilog:

cd .\serilog\
docker compose up

If you decide to run the application outside of Docker in your terminal, don't forget to change the request URI to http://localhost:31311. More information can be found in .\serilog\Program.cs.

Using Kibana to render the log events

Access the Kibana web UI by hitting http://localhost:5601 with a web browser, and when prompted enter username elastic and password changeme.

Credit

The elastic-stack directory is a clone of docker-elk with minor modifications. Credit to deviantony for publishing the Elastic Stack boilerplate.

serilog-sinks-http-sample-elastic-stack's People

Contributors

fantasticfiasco avatar github-actions[bot] avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

serilog-sinks-http-sample-elastic-stack's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Port 5000 already used on macOS

Describe the bug
Port 5000 on macOS is already in use if you're using Airplay. Let's configure Logstash to use another port.

To Reproduce
Just follow the instructions in README.md

Desktop (please complete the following information):

  • OS: macOS

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

docker-compose
elastic-stack/docker-compose.yml
serilog/docker-compose.yml
dockerfile
elastic-stack/elasticsearch/Dockerfile
elastic-stack/kibana/Dockerfile
elastic-stack/logstash/Dockerfile
elastic-stack/setup/Dockerfile
serilog/Dockerfile
  • mcr.microsoft.com/dotnet/sdk 8.0-alpine
github-actions
.github/workflows/ci-cd.yml
  • actions/checkout v4
  • docker/setup-buildx-action v3
.github/workflows/update-copyright-years-in-license-file.yml
  • actions/checkout v4
  • FantasticFiasco/action-update-license-year v3
nuget
serilog/serilog-example.csproj
  • Serilog.Sinks.Http 9.0.0
  • Serilog.Sinks.Console 5.0.1
  • Serilog.Extensions.Logging 8.0.0
  • Bogus 35.5.1

  • Check this box to trigger a request for Renovate to run again on this repository

LogsStash confing does not handle bundled events

LogStash config in your example:

http {
    codec => json
}

This does not work with JSON format this sink is sending (all events are treated as single message by logstash):

{
  "events": [
    {
        <..>
    }
  ]
}

What I'm missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.