'How to send logs to a different location : Kubernetes

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



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Everton