Solved newsyslog delayed compression

abdelilah

Member

Reaction score: 4
Messages: 93

Hello everyone,

How can I achieved delayed compression like the one existing in logrotate, here is my config (I did not find this in the man) :

Code:
/var/log/apache24/httpd-access.log  644  52  *  @T04 J  /var/run/httpd.pid 30
I wish to delay the compression by one day :

- Current log.
- Rotated log.
- Compressed log.

Thanks
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,370
Messages: 29,907

As far as I know newsyslog(8) doesn't have that feature. Alternatively, if you have ZFS, you could enable compression on the filesystem, then you wouldn't need to compress the files individually.
 

Juha Nurmela

Well-Known Member

Reaction score: 121
Messages: 401

You could compress the .2 file by hand. Take out the J flag from the entry in question (J to -) and change the command in /etc/crontab to newsyslog; /full/path/to/bzip2 /var/log/apache24/httpd-access.log.2.

Untested etc,
Juha

newsyslog(8) does accept .bz2 nicely, even if it did not compress the file himself. Herself.
 
OP
OP
abdelilah

abdelilah

Member

Reaction score: 4
Messages: 93

Thanks for the answers, I guess I'll have to stick with logrotate to achieve it natively, too bad newsyslog does not have this feature.
 
OP
OP
abdelilah

abdelilah

Member

Reaction score: 4
Messages: 93

As far as I know newsyslog(8) doesn't have that feature. Alternatively, if you have ZFS, you could enable compression on the filesystem, then you wouldn't need to compress the files individually.
I don't have ZFS, other than logrotate what should I do ?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,370
Messages: 29,907

Learn to use bzless and bzcat (both can read compressed and uncompressed files)? That's what I use.
 
OP
OP
abdelilah

abdelilah

Member

Reaction score: 4
Messages: 93

Thanks for all your answers, I finally used newsyslog on kannel with its default compression method, but it will be great if there is a delayed compression like in logrotate.
 
Top