tailing-sidecar
tailing-sidecar copied to clipboard
[Proposal] logrotate enhancement
In some scenarios, our application logs in Pod will not rotate log files, such as envoy
's access log.
So, Can we add that feature in tailing sidecar container image
For my undstanding, We have 2 options to support:
- We could add a feature by
LOGROTATE
env intailing sidecar container image
https://github.com/SumoLogic/tailing-sidecar/blob/main/sidecar/Dockerfile
And for sidecar configuration in https://github.com/SumoLogic/tailing-sidecar/blob/main/operator/docs/configuration.md#sidecarspec:
metadata:
annotations:
tailing-sidecar: <sidecar-name-0>:<volume-name-0>:<path-to-tail-0>:false;<sidecar-name-1>:<volume-name-1>:<path-to-tail-1>:true
false
are default here and represents don't need logrotate
, but this way may looks inflexible.
- Or maybe we can support a new annotations like:
metadata:
annotations:
tailing-sidecar-logrotate: <log-path-to-rotate-0>:<logrotate-config-json-string>
#tailing-sidecar-logrotate: sample.log:"{\n size 1k\n copytruncate\n create 700 root root\n rotate 4\n compress\n}"
operator
will parse tailing-sidecar-logrotate
and make a logrotate.conf in tailing-sidecar-image
as follows:
sample.log {
size 1k
copytruncate
create 700 root root
rotate 4
compress
}