Running a Logging Pipeline Locally

You may wish to test a logging pipeline locally to observe how it deals with log messages. The following is a walk-through for running Fluent Bit and Elasticsearch locally with Docker Compose which can serve as an example for testing other plugins locally.

Create a Configuration File

Refer to the Configuration File section to create a configuration to test.

fluent-bit.conf:

  1. [INPUT]
  2. Name dummy
  3. Dummy {"top": {".dotted": "value"}}
  4. [OUTPUT]
  5. Name es
  6. Host elasticsearch
  7. Replace_Dots On

Docker Compose

Use Docker Compose to run Fluent Bit (with the configuration file mounted) and Elasticsearch.

docker-compose.yaml:

  1. version: "3.7"
  2. services:
  3. fluent-bit:
  4. image: fluent/fluent-bit
  5. volumes:
  6. - ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
  7. depends_on:
  8. - elasticsearch
  9. elasticsearch:
  10. image: elasticsearch:7.6.2
  11. ports:
  12. - "9200:9200"
  13. environment:
  14. - discovery.type=single-node

View indexed logs

To view indexed logs run:

  1. curl "localhost:9200/_search?pretty" \
  2. -H 'Content-Type: application/json' \
  3. -d'{ "query": { "match_all": {} }}'

To “start fresh”, delete the index by running:

  1. curl -X DELETE "localhost:9200/fluent-bit?pretty"