Log rotation in Træfik

Till Klampaeckel
PlanetaryNetworks
Published in
2 min readDec 11, 2018

While doing our research for on-premise (or bare-metal) load balancing with Kubernetes, Træfik kept popping up in suggestions, Google etc..

Træfik as an “edge-router” in front of your orchestrator. (Credit: traefik.io)

Taking a longer look, we found that while it offers a tightly knit integration into Kubernetes or Docker in general, Træfik is a very young project and should be treated as such.

When I compare Træfik to more established solutions such as HAProxy or nginx, its advantage is definitely the tight integration with container orchestrators, but then it falls short with stability, supported protocols (TL;DR use HTTP(s) or don’t use Træfik) and last but not least: available knowledge (via Google) or documentation.

For those of us with an operations (or “devops”) background another interesting development is, that projects like Træfik support “Docker first”.

Of course I can operate it without Docker but almost no one seems to be doing that and I ran into all odd defaults — for example, its logs are usually handled by a system collecting logs from stdout (a standard pattern with container orchestration) or the daemon doesn’t (even) write a PID file.

Long story short — here’s a configuration snippet for logrotated (in case Træfik runs on a dedicated host, etc.):

For the record, I am not recommending to install logrotated into a container (with Træfik).

FIN

That’s all. We will probably post more of these tidbits and snippets as we move through evaluation.

--

--

Till Klampaeckel
PlanetaryNetworks

I’m Till. From Berlin. Mostly sarcastic about technology, but never the less interested in it.