1

So I want to develop multiple flavors of log one for generic use and other for performing a specific operation

I want to separate those logs by storing them in a different location and using them for further processing.

I can see the logs in Kubernetes clusters are stored in nodes - /var/log/container/.log. How can I store specific logs in a separate place (maybe something like /var/log/container/specificoperation/.log.) What changes I need to do in kubernetes architecture to make this happen

Library I am using for logging: https://github.com/uber-go/zap

EagerLearner
  • 447
  • 1
  • 5
  • 11
  • Why not use a local Logstash instance with different ports for each kind of log? Or setting some other metadata/tag – Rafael de Bem Apr 29 '22 at 03:14
  • @RafaeldeBem: Can you quote an example ? – EagerLearner Apr 29 '22 at 04:15
  • [Filebeat/Logstash and Zap](https://www.elastic.co/guide/en/ecs-logging/go-zap/current/setup.html) can be used together to ship your logs somewhere else, say Zabbix/Elasticsearch/Prometheus. It's a separate service that listens on a TCP port for logs. You can also use Filebeat on Kubernetes easily. – Rafael de Bem Apr 29 '22 at 13:44
  • [Grafana and Loki](https://grafana.com/oss/loki/) are pretty nice, i believe you can backup logs to S3 or Dynamo if you run in AWS – BLang Apr 30 '22 at 02:03

1 Answers1

0

One common architecture is to install a node-level collector as a daemon set, for example filebeat, direct the collector's output to logstash, then use logstash pipeline rules to selectively direct logs to the final destinations.

Everton
  • 12,589
  • 9
  • 47
  • 59
  • I am storing logs at a custom location(not stdout or stderr). I can see the logs inside the pods(when I ssh to the pods) rather than in the nodes. As such node-level collector won't work. Unless I am missing something – EagerLearner May 04 '22 at 01:01
  • You can also configure filebeat as a sidecar container within your pod to collect from its log files. – Everton May 04 '22 at 04:00
  • Any example that you can suggest how to do so. I am using docker desktop to simulate kubernetes – EagerLearner May 04 '22 at 05:31