sematext / logagent-js

Extensible log shipper with input/output plugins, buffering, parsing, data masking, and small memory/CPU footprint
https://sematext.com/logagent
Apache License 2.0
389 stars 79 forks source link

Fix #224 - Enable advanced log routing when running Logagent with Docker #231

Closed adnanrahic closed 4 years ago

adnanrahic commented 4 years ago

This PR fixes #224 and enables fine-grained log routing with Docker.

I've added another env var option. LOGS_RECEIVER_URLS will enable adding multiple receiver URLs in a comma separated list. These URLs need to contain the token/index of the Elasticsearch endpoint as well.

The existing LOGS_RECEIVER_URL env var is now limited to one endpoint and requires adding the LOGS_TOKEN as a separate env var.

It is now possible to add LOGS_TOKEN and LOGS_RECEIVER_URL to the env vars of containers you want to ship logs for. Setting them on a container-basis will overwrite default settings. Using it with LA_CONFIG_OVERRIDE=true with LOGS_ENABLED_DEFAULT=false in the Logagent container env vars will let you disable log shipping for all containers except for container where you set LOGS_ENABLED=true, LOGS_TOKEN, and LOGS_RECEIVER_URL.