Description

Getting below error message while compressing varlogs from a device.

 

lab> file archive compress source /var/log/* destination /var/tmp/var_logs.tgz  

/usr/bin/tar: Removing leading `/' from member names

/usr/bin/tar: /var/log/messages: file changed as we read it 1682357702 != 1682357700

/usr/bin/tar: Error exit delayed from previous errors

error: /usr/bin/tar was not successful

Symptoms

The “error: file changed as we read it” error is a common error that occurs when compressing. This error typically indicates that the tar command is trying to read a file that is being modified at the same time. There are several scenarios that can trigger this error, such as the modification of a file during the backup process or the opening of a file by another program while the backup is in progress.

Solution

To overcome this error, kindly follow below steps to compress varlogs

 

From CLI

lab> start shell

% cd /var/log

% tar -czvf --ignore-failed-read varlogs.tgz /var/log/*

% mv varlogs.tgz /var/tmp/.

 

Post this the varlogs should be available in the /var/tmp/ directory for further use.

Modification History

05/22/2023
1st version