Ways to avoid "file changed as we read it" when collecting support bundle?

Hello!

Our application stores logs on a file in a pod. We have the following support-bundle.yaml:


apiVersion: troubleshoot.replicated.com/v1beta1
kind: Collector
metadata:
name: collector-sample
spec:
collectors:
- clusterInfo: {}
- clusterResources: {}
- logs:
collectorName: app-logs
name: app/logs
selector:
- component=comp
- copy:
name: pod-logs
selector:
- app=workers
containerPath: /var/www/html/storage/logs/laravel.log

The problem is, this file is most of the time constantly changed, so often, when we try to generate a bundle, we can’t get that file and instead we get this one file called “laravel.log-errors.json” with the following contents:

{
“/var/www/html/storage/logs/laravel.log/error”: “failed to stream command output: command terminated with exit code 1”,
“/var/www/html/storage/logs/laravel.log/stderr”: “tar: laravel.log: file changed as we read it\n”
}

Any recommendations on what to do in this case?

Hi Alexader,

The error you are seeing is caused by tar when it detects the file changing as it archives it. This happens here. There is room for improvement here since tar should be able to still archive a file even if it has changed. Could you please file an issue here so we can take a look? Please provide steps to reproduce the issue as well, and if possible, a reproducer application.

Evans