I am new to Loki and Promtail. I’ve only been using them for a few days.
I’m running Promtail in a docker container. Is there a “correct” way to keep positions.yaml (which is in /tmp inside the docker container) when creating a new Promtail container so that the new Promtail doesn’t start at the beginning of the log files and send duplicate log lines to Loki?
If you are using some sort of docker orchestration (such as kubernetes or docker compose), make sure to run Promtail as DAEMON (one count per host), and mount a host directory to your promtail container to store position file. This ensures that you have one promtail container watching over each host, and because the volume mounted from host it ensures the position file both persists and is only applicable for the host itself.