I have been struggling with handling some pesky encoded characters in 
mail logs as of late.

My issue involves passing the message on to a remote rsyslog server 
which then processes the messages into a database. From time to time I 
see messages with something similar to the following:

"Subject:<RE: VIAGRA \256 Official Site ID031831740>"

In my case, messages are passed to processing mechanisms via triggers 
prior to a final insertion but I am getting DB errors based on the 
handling of these "invalid" characters.

I don't think the use of mime2utf8 will help me in these types of 
instances. Also, after looking through previous mailing list messages 
I've seen references to somewhat similar types of issues with the use of 
setting the LANG= value with the invocation of amavisd-new. I may be not 
thinking this through clearly, but I don't think that would help much in 
this case since everything is happening after the fact on a completely 
different system.

Would I be better off in the log template doing some type of find and 
replace regex on the fields to help escape these characters? Is that 
even possible? Typically I'd do this in the code that is called by the 
trigger but I'm not quite getting that far along in the processing yet 
to do that. My thinking at this point is to escape any backslashes 
before I write the log and then hopefully I can handle the escaped 
characters elsewhere.

I see the following noted in the README.customize file:

"If assigning to variables, care must be taken to properly quote certain
special characters (like backslash), as required by Perl quoting rules.
Text read from amavisd file or from external files is not subject
to Perl quoting rules."

But what is the best practice to do so within the templates and the 
available macros? Or is it more raw perl within the template that I need 
to consider?

My apologies if this is a bit off-topic for the list but any ideas would 
be appreciated.

Clay

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 Please visit http://www.ijs.si/software/amavisd/ regularly
 For administrativa requests please send email to rainer at openantivirus dot 
org

Reply via email to