LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-20-2017, 09:57 PM   #1
ridemeve2017
LQ Newbie
 
Registered: Jul 2017
Posts: 2

Rep: Reputation: Disabled
Active log.bz2 file - Need to copy the active file without corrupting


Hi,

I have a compressed log file which gets restarted everyday and starts a new log i.e. todays log file 21072017.bz2.

I need to take a snapshot of the active log file and copy it to another directory in order to decompress and view the file contents.

so I copied the file to /temp

when I then run bzip2 -d 21072017.log.bz2 I get the following:


bzip2: Compressed file ends unexpectedly;
perhaps it is corrupted? *Possible* reason follows.
bzip2: No such file or directory
Input file = 21072017.log.bz2, output file = 21072017.log

It is possible that the compressed file(s) have become corrupted.
You can use the -tvv option to test integrity of such files.

You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.

bzip2: Deleting output file 20170721.log, if it exists.

Any help on how I can hot copy or snapshot this file please would be great.
 
Old 07-21-2017, 12:13 AM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Try this
Code:
$ dd if=./21072017.log.bz2 | bunzip2 - > 21072017.log
or
Code:
$ bzcat 21072017.log.bz2
 
Old 07-21-2017, 12:34 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Symlinks to the same program - unlikely to make a difference.

@ridemeve2017 are you saying this file is continually being written to ?.
 
Old 07-21-2017, 12:44 AM   #4
ridemeve2017
LQ Newbie
 
Registered: Jul 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
Symlinks to the same program - unlikely to make a difference.

@ridemeve2017 are you saying this file is continually being written to ?.
Yes the file is always being written to for a 24 hour period. A new log file is created every 24 hours.
 
Old 07-21-2017, 02:08 AM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
I'm not seeing bunzip2 or bzcat as symlinks. If the log file is running through a bzip2 process, and it is never quite finished, then using the dd method above to uncompress it as a bit stream may work. the bzip2 program has a lot of checks in it with multiple different options. I don't think bunzip2 and bzcat pay any attention to those.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to see active downloading file log in squid? nabat1 Linux - Software 1 05-01-2013 11:37 AM
[SOLVED] [C++] How to fetch the process id of the currently active C++ file? Aquarius_Girl Linux - Newbie 2 02-11-2013 04:41 AM
/proc/meminfo - Active(file) engr04 Linux - Newbie 8 10-19-2012 06:42 PM
active directory + samba + ntlm + squid + dansguardian log file jatender Linux - Server 3 12-03-2009 01:09 PM
How to rollover the active log file in solaris without loosing any info rajaniyer123 Solaris / OpenSolaris 1 05-11-2008 08:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration