Giter Club home page Giter Club logo

serilog-logspout-elastic-stack's Introduction

Serilog, Logspout 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 using Logspout, 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 on Windows

Bringing up Elastic Stack

Start the stack using docker:

cd .\elastic-stack\
docker compose up

If this is the first time the stack is started, you'll have to create a Logstash index pattern. Give the stack some time to initialize and then run the following commands in PowerShell:

$Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"; `
$Headers.Add("Content-Type", "application/json"); `
$Headers.Add("kbn-version", "6.8.0"); `
Invoke-RestMethod "http://localhost:5601/api/saved_objects/index-pattern" `
  -Method Post `
  -Headers $Headers `
  -Body '{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'

Publishing log events using Serilog

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

cd .\serilog\
docker compose up

Using Kibana to render the log events

Access the Kibana web UI by hitting http://localhost:5601 with a web browser.

Usage on Linux

Bringing up Elastic Stack

Start the stack using docker:

cd elastic-stack/
docker compose up

If this is the first time the stack is started, you'll have to create a Logstash index pattern. Give the stack some time to initialize and then run the following commands:

curl -XPOST -D- 'http://localhost:5601/api/saved_objects/index-pattern' \
  -H 'Content-Type: application/json' \
  -H 'kbn-version: 6.8.0' \
  -d '{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'

Publishing log events using Serilog

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

cd serilog/
docker compose up

Using Kibana to render the log events

Access the Kibana web UI by hitting http://localhost:5601 with a web browser.

Credit

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

serilog-logspout-elastic-stack's People

Contributors

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

Watchers

 avatar  avatar

Forkers

netdefender

serilog-logspout-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.

Dependency Dashboard

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

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update fantasticfiasco/action-update-license-year action to v3
  • chore(deps): update mcr.microsoft.com/dotnet/sdk docker tag to v8
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
elastic-stack/docker-compose.yml
serilog/docker-compose.yml
dockerfile
elastic-stack/elasticsearch/Dockerfile
  • docker.elastic.co/elasticsearch/elasticsearch-oss 6.8.0
elastic-stack/extensions/logspout/Dockerfile
elastic-stack/kibana/Dockerfile
  • docker.elastic.co/kibana/kibana-oss 6.8.0
elastic-stack/logstash/Dockerfile
  • docker.elastic.co/logstash/logstash-oss 6.8.0
serilog/Dockerfile
  • mcr.microsoft.com/dotnet/sdk 5.0-alpine
github-actions
.github/workflows/update-copyright-years-in-license-file.yml
  • actions/checkout v2
  • FantasticFiasco/action-update-license-year v2
nuget
serilog/serilog-example.csproj
  • Serilog.Sinks.Console 3.1.1
  • Serilog.Formatting.Elasticsearch 8.4.1
  • Serilog.Extensions.Logging 3.0.1
  • Serilog.Exceptions 6.0.0
  • Bogus 32.0.2

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

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.