Re: [Exim] question about smtp-traffic, example smtp-filter

Top Page
Delete this message
Reply to this message
Author: Development - multi.art.studio
Date:  
To: exim-users
CC: Yves Goergen, Philip Hazel, Tor Slettnes
Old-Topics: Re: [Exim] question about smtp-traffic
Subject: Re: [Exim] question about smtp-traffic, example smtp-filter
Hi,

Yves Goergen wrote:

>And I also want to count messages that go in AND out, not only
>deliveries in one direction. (My latest pattern for this is in my mail
>from almost 19h ago.) The goal should be to count everything that goes
>over the network for the affected user(s), since we will have to pay the
>traffic and want to re-account it to our users, right?


my filter does it :)

try a simple system_filter like
----snip
system_filter = /home/Exim/etc/exim_trafficlog.filter
system_filter_user = exim

---snip

and etc/exim_trafficlog.filter could look like this:

----snip
# Exim filter
logfile /home/LOGS/Exim/exim-traffic.log 0644
logwrite "$tod_log ID=$message_id D=$domain L=$local_part OL=$original_local_part T=$h_to F=$h_from S=$message_size B=$message_body_size FR=$reply_address"
----snip

(you have to restart exim after applying the filter to the configfile)

i tested it last night and since then its running fine, i sitting here
and tail my new logfile ;)

but there must be a tuning of the filter,
* because also maildelivery to local domains on the same server are
logged...
* my amavis router writes new message id's , messages are logged twice
with different header sizes
* it logs everything from localhost send to local_domains
i think this can be done by using sieve

two questions about his:
1. the only thing i miss is $domain has no value? any ideas what to use
for domain?
2. can i set up a filter that uses lookups and exim-style if clauses?
3. can i setup a filter for use in only some routers? or transports?

> Volker mentioned about patching the quota stuff to count messages there.
> This is not the appropriate place, I think, because it will only see
> local deliveries, but no relay traffic. jm2c to this one.



:-) not IN the quota function, but like the quota functions does its
update of the mailsirsizefile, we could have a function like
smtp_quota=....lookup... and get smtp_quota from database or from
whereelse (dbm, flatfile), then updating exim_trafficlog file or whatever.
maybe give a directory for the file. e.g. i use
/home/MAILDIR/customer1,2,3/000,001,034 etc as maildir for different
customers
customer1 has a lot of domains, 000, 001, 034 of customer1 are the
maildirs for different accounts for his domains.
so maybe we could write to customer1/exim_trafficlog if we can get the
file from a simple lookup like we do it for maildirs.
but this cant be done by a simple filter i think, thi smust be done in
c, local_scan, or included in exim.....


greetings,

yours volker

>
> --
> Yves Goergen <nospam.list@???>
>
> BlackBoard Internet Newsboard System --> blackboard.unclassified.de
> Free (GPL), easy to use and install, secure, innovative! (PHP+MySQL)
>
> --
>
> ## List details at http://www.exim.org/mailman/listinfo/exim-users
> Exim details at http://www.exim.org/ ##
>
>