I'm trying to decide between using HTTP and syslog for logging in my Kubernetes setup. I know that HTTP might have higher overhead, but I'm curious about the pros and cons of each method when it comes to logging stdout and stderr for my infrastructure. What should I consider when choosing between the two? Is one significantly better for my use case?
4 Answers
Syslog has been around for a while and is widely supported by most logging tools and appliances. It's reliable and a safe bet if you're looking for something that's well-established. However, you might wonder why you would use a sidecar instead of just a dedicated log collector?
I’d recommend skipping the sidecar for logging entirely. Kubernetes has built-in solutions for log collection, like Loki, which works seamlessly with the Grafana stack.
Instead of complicating things, just log to stdout or stderr in a structured format, such as JSON. Then, use an out-of-band system like Fluentd or Logstash to handle your logs. These agents can choose the best protocol to use for sending those logs.
If you're interested in collecting logs from all your containers in Kubernetes, check out this helm chart: [VictoriaLogs](https://docs.victoriametrics.com/helm/victorialogs-single/). It sets everything up nicely and stores all logs effectively.
Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures