summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2014-02-02 14:11:34 +0000
committerbdrewery <bdrewery@FreeBSD.org>2014-02-02 14:11:34 +0000
commited4da825525de3a4b12e335efccbd2d92474fb19 (patch)
tree9c87ffb9ca1042a4f9aec9678322ee40bcead447 /usr.sbin/newsyslog
parentd86e904d3f143994a2acfcbbd7c65f82304ecad1 (diff)
downloadFreeBSD-src-ed4da825525de3a4b12e335efccbd2d92474fb19.zip
FreeBSD-src-ed4da825525de3a4b12e335efccbd2d92474fb19.tar.gz
Fix newsyslog(8) to use the size of the file instead of the blocks it
takes on disk, as advertised in newsyslog.conf(5). This fixes newsyslog(8) on ZFS with compression enabled to not have large files compared to the expected rotation size. # grep remotes/messages /etc/newsyslog.conf /var/log/remote/messages root:info 640 5 500 * JC # ls -alh /var/log/remote/messages -rw-r----- 1 root info 3.2M Jan 31 20:02 /var/log/remote/messages # newsyslog -vN|grep remote/messages /var/log/remote/messages <5J>: size (Kb): 464 [500] --> skipping # stat -f "st_size: %z st_blocks: %b" /var/log/remote/messages st_size: 3372627 st_blocks: 928 # zfs get -H compressratio zroot/syslogs zroot/syslogs compressratio 3.77x - With fix: # newsyslog -v | grep remote/messages /var/log/remote/messages <5J>: size (Kb): 3338 [500] --> trimming log.... Approved by: bapt (mentor) PR: docs/150877 Reported by: Joshua Isom <jrisom@gmail.com> MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r--usr.sbin/newsyslog/newsyslog.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index 66856d2..ff9e937 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -2284,7 +2284,7 @@ sizefile(const char *file)
if (stat(file, &sb) < 0)
return (-1);
- return (kbytes(dbtob(sb.st_blocks)));
+ return (kbytes(sb.st_size));
}
/*
OpenPOWER on IntegriCloud