improved logging of retention days

This commit is contained in:
SJ 2013-07-31 10:06:05 +02:00
parent 7ea15b5b05
commit d1cae282dc
5 changed files with 10 additions and 4 deletions

View File

@ -14,7 +14,7 @@
#define VERSION "0.1.24-master-branch"
#define BUILD 827
#define BUILD 828
#define HOSTID "mailarchiver"

View File

@ -172,6 +172,8 @@ struct _state {
int bodylen;
int tolen;
int journaltolen;
int retention;
};

View File

@ -97,6 +97,8 @@ void init_state(struct _state *state){
state->tolen = 0;
state->bodylen = 0;
state->journaltolen = 0;
state->retention = 0;
}

View File

@ -200,7 +200,7 @@ unsigned long query_retain_period(struct __data *data, struct _state *state, int
if(p->domainlen > 2){
if(strcasestr(state->b_to_domain, p->domain) || strcasestr(state->b_from_domain, p->domain)){
if(cfg->verbosity >= _LOG_INFO) syslog(LOG_INFO, "from domain: '%s', to domain: '%s', retention days: %d", state->b_from_domain, state->b_to_domain, p->days);
state->retention = p->days;
return p->days * 86400;
}
}
@ -213,13 +213,15 @@ unsigned long query_retain_period(struct __data *data, struct _state *state, int
check_attachment_rule(state, p) == 1 &&
check_spam_rule(spam, p->spam) == 1
){
if(cfg->verbosity >= _LOG_INFO) syslog(LOG_INFO, "from domain: '%s', to domain: '%s', retention days: %d", state->b_from_domain, state->b_to_domain, p->days);
state->retention = p->days;
return p->days * 86400;
}
p = p->r;
}
state->retention = cfg->default_retention_days;
return cfg->default_retention_days * 86400;
}

View File

@ -262,7 +262,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
(sdata.__acquire+sdata.__parsed+sdata.__av+sdata.__compress+sdata.__encrypt+sdata.__store)/1000000.0,
sdata.__acquire/1000000.0, sdata.__parsed/1000000.0, sdata.__av/1000000.0, sdata.__compress/1000000.0, sdata.__encrypt/1000000.0, sdata.__store/1000000.0);
syslog(LOG_PRIORITY, "%s: from=%s, size=%d, reference=%s, message-id=%s, %s", sdata.ttmpfile, sdata.fromemail, sdata.tot_len, sstate.reference, sstate.message_id, delay);
syslog(LOG_PRIORITY, "%s: from=%s, size=%d, reference=%s, message-id=%s, retention=%d, %s", sdata.ttmpfile, sdata.fromemail, sdata.tot_len, sstate.reference, sstate.message_id, sstate.retention, delay);