Promtail agent remove target when log directory is empty

Hi All
In one of the Kubernetes deployment, the promtail runs as side car container and is responsible for watching the application log file on shared (emptyDir) Kubernetes volume.
In particular scenario Promtail agent container starts before application container, hence do not find any file at configured path.
Hence watcher stops and removes watch target.
Is there any configuration available in promtail config to instruct watcher to wait for log files to become available or retry after some time ?
Is there any configuration available in promtail config to instruct watch to wait for retry after some time ?

You could perhaps try init and place an empty file at the target location?

Or you can try another approach:

  1. Have application log to stdout, have stdout log to host.
  2. Run promtail as DAEMON, picks up all logs from host.

I prefer this because it’s much more straightforward, and you can re-use the same pattern for all containers without having to have many sidecars running.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.