Closed otisg closed 8 years ago
We should discuss three options:
C - We could use the Docker API to scan the environment variables of started container for LOGSENE_TOKEN. Users simple add -e LOGSENE_TOKEN=token to the Containers run command (Nginx, Elasticsearch, ...) and SPM Agent will recognize that the Logs should be routed to the specified Logsene Applications. This could be extended to additional config settings like filters (e.g. to log only errors). Example:
docker run -e LOGSENE_TOKEN=YOUR_ES_APP_TOKEN
LOGSENE_FILTER="error|exception|warning" -p 9200:9200 elasticsearch
docker run -e LOGSENE_TOKEN=YOUR_WEB_APP_TOKEN -p 80:80 nginx
Logs of Containers without LOGSENE_TOKEN will be routed to the default Logsene App specified during startup of sematext/spm-agent-docker.
I strongly recommend solution C. The Configuration is made per App container. Nobody needs to maintain configuration files for it, or write API interfaces. There is no network service involved, which means no API related security issues to deal with. Plus the auto discovery functions might be helpful for other features in the future.
If I have 2 containers, one running Apache and the other one running Elasticsearch, just for example, I may actually want to send their logs to 2 different Logsene apps.