Logsidecar-injector is a Kubernetes mutating webhook server that adds a sidecar to your pod. This sidecar is just to forward logs from files on volumes to stdout.
Install
To quickly install the logsidecar injector inside a cluster, just run the following command:
relativepath is relative path to mountpath within container containername at which volume volumename was mounted.
Optionally customize your configuration of filebeat in sidecar container:
Add logging.kubesphere.io/logsidecar-filebeat-config-jsonpatch annotation to pod template of your workload. The value of this annotation is a jsonpatch string. Logsidecar-injector will generate a new configuration based on default filebeat configuration and this patch, then apply it to the injected sidecar container for your specified workload pod. Here is an example: