Skip to content

PiotrJustyna/special-octo-fiesta

Repository files navigation

special-octo-fiesta

A simplified, batteries included, local logging setup of:

  • f# worker service
  • elasticsearch
  • kibana
  • docker compose

This should help you configure propagation of logs for the elk stack (logstash excluded). The setup does not include more advanced log shipping elk mechanisms like logstash/filebeat.

This repository started as an attempt to configure otel logs with the elk stack, but the setup is was complex that I realised there could be value in skipping otel for now and demonstrating how simple the configuration could be if we only use the serilog-to-elasticsearch sink. This is by no means production grade setup, but it shows concisely how to set logging up. You can experiment furtner by building on top of this code.

features

logs

console

hello logging
[10:11:10 INF] Application started. Press Ctrl+C to shut down.
[10:11:10 INF] Worker running at: 08/21/2023 10:11:10 +00:00
[10:11:10 INF] Hosting environment: Production
[10:11:10 INF] Content root path: /tmp/sample-worker
[10:11:11 INF] Worker running at: 08/21/2023 10:11:11 +00:00
[10:11:12 INF] Worker running at: 08/21/2023 10:11:12 +00:00
[10:11:13 INF] Worker running at: 08/21/2023 10:11:13 +00:00

kibana

{
  "@timestamp": [
    "2023-08-21T10:11:26.331Z"
  ],
  "fields.Environment": [
    "Development"
  ],
  "fields.Environment.raw": [
    "Development"
  ],
  "fields.SourceContext": [
    "SampleFSharpWorker.Workers.Worker"
  ],
  "fields.SourceContext.raw": [
    "SampleFSharpWorker.Workers.Worker"
  ],
  "fields.time": [
    "2023-08-21T10:11:26.331Z"
  ],
  "level": [
    "Information"
  ],
  "level.raw": [
    "Information"
  ],
  "message": [
    "Worker running at: 08/21/2023 10:11:26 +00:00"
  ],
  "messageTemplate": [
    "Worker running at: {time}"
  ],
  "messageTemplate.raw": [
    "Worker running at: {time}"
  ],
  "_id": "umGTF4oBiYOsWcb28gvo",
  "_index": "samplefsharpworker-development-2023-08",
  "_score": null
}

how to use

  • ./start-development-environment.sh
  • ./stop-development-environment.sh
  • ./build.sh
  • ./run.sh
  • ./nuke-development-environment.sh

kibana

resources used