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

**URL:** <https://community.replicated.com/t/ways-to-avoid-file-changed-as-we-read-it-when-collecting-support-bundle/1393>\
**Category:** How do I?\
**Tags:** support-bundle\
**Created:** [March 26, 2024, 1:13pm UTC](https://community.replicated.com/t/ways-to-avoid-file-changed-as-we-read-it-when-collecting-support-bundle/1393 "2024-03-26T13:13:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Nitu](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/alexander_nitu/32/535_2.png) [@Alexander\_Nitu](https://community.replicated.com/u/Alexander_Nitu)\
**Post date:** [March 26, 2024, 1:13pm UTC](https://community.replicated.com/t/ways-to-avoid-file-changed-as-we-read-it-when-collecting-support-bundle/1393/1 "2024-03-26T13:13:42Z")

</div>

Hello!

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

* * *

apiVersion: [troubleshoot.replicated.com/v1beta1](http://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?

---

<div class="post-metadata">

**Author:** ![Evans\_Mungai](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/evans_mungai/32/546_2.png) [@Evans\_Mungai](https://community.replicated.com/u/Evans_Mungai)\
**Post date:** [March 26, 2024, 7:32pm UTC](https://community.replicated.com/t/ways-to-avoid-file-changed-as-we-read-it-when-collecting-support-bundle/1393/2 "2024-03-26T19:32:08Z")

</div>

Hi Alexader,

The error you are seeing is caused by `tar` when it detects the file changing as it archives it. This happens [here](https://github.com/replicatedhq/troubleshoot/blob/bece801ba85b310c7f319ae5aa52a4bc32c84cb7/pkg/collect/copy.go#L93). 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](https://github.com/replicatedhq/troubleshoot/issues) so we can take a look? Please provide steps to reproduce the issue as well, and if possible, a reproducer application.

Evans
