version 1.90, 2012/01/15 13:02:12 |
version 1.91, 2013/04/05 01:29:07 |
|
|
do_entry(struct conf_entry *ent) |
do_entry(struct conf_entry *ent) |
{ |
{ |
struct stat sb; |
struct stat sb; |
int modtime; |
int modhours; |
off_t size; |
off_t size; |
|
|
if (lstat(ent->log, &sb) != 0) |
if (lstat(ent->log, &sb) != 0) |
|
|
(ent->flags & CE_FOLLOW) ? "F" : "", |
(ent->flags & CE_FOLLOW) ? "F" : "", |
(ent->flags & CE_MONITOR) && monitormode ? "M" : "")); |
(ent->flags & CE_MONITOR) && monitormode ? "M" : "")); |
size = sizefile(&sb); |
size = sizefile(&sb); |
modtime = age_old_log(ent); |
modhours = age_old_log(ent); |
if (ent->flags & CE_TRIMAT && !force) { |
if (ent->flags & CE_TRIMAT && !force) { |
if (timenow < ent->trim_at || |
if (timenow < ent->trim_at || |
difftime(timenow, ent->trim_at) >= 60 * 60) { |
difftime(timenow, ent->trim_at) >= 60 * 60) { |
|
|
DPRINTF(("size (KB): %.2f [%d] ", size / 1024.0, |
DPRINTF(("size (KB): %.2f [%d] ", size / 1024.0, |
(int)(ent->size / 1024))); |
(int)(ent->size / 1024))); |
if (ent->hours > 0) |
if (ent->hours > 0) |
DPRINTF(("age (hr): %d [%d] ", modtime, ent->hours)); |
DPRINTF(("age (hr): %d [%d] ", modhours, ent->hours)); |
if (monitormode && (ent->flags & CE_MONITOR) && domonitor(ent)) |
if (monitormode && (ent->flags & CE_MONITOR) && domonitor(ent)) |
DPRINTF(("--> monitored\n")); |
DPRINTF(("--> monitored\n")); |
else if (!monitormode && |
else if (!monitormode && |
(force || (ent->size > 0 && size >= ent->size) || |
(force || (ent->size > 0 && size >= ent->size) || |
(ent->hours <= 0 && (ent->flags & CE_TRIMAT)) || |
(ent->hours <= 0 && (ent->flags & CE_TRIMAT)) || |
(ent->hours > 0 && (modtime >= ent->hours || modtime < 0) |
(ent->hours > 0 && (modhours >= ent->hours || modhours < 0) |
&& ((ent->flags & CE_BINARY) || size >= MIN_SIZE)))) { |
&& ((ent->flags & CE_BINARY) || size >= MIN_SIZE)))) { |
DPRINTF(("--> trimming log....\n")); |
DPRINTF(("--> trimming log....\n")); |
if (noaction && !verbose) |
if (noaction && !verbose) |