Oops! I replied before I remembered how I actually solved this problem. Like
you, I couldn't find a way to add real newlines while in SEC, so I do it in
my notification script instead. Mine's perl, and looks something like:

open OUTFILE, "|/usr/sbin/sendmail -t";
print OUTFILE "Subject: $subject\n";
print OUTFILE "To: $to\n";
print OUTFILE "From: $from\n";
print OUTFILE "\n";
while (<>) {
  # replace \n with real newlines
  $_ =~ s/\\n/\n/g;
  print OUTFILE $_;
}

An added benefit of this method is that the replacement will be done on the
captured log data as well. This can be helpful if you're monitoring a log
which may contain stack traces or other multi-line data which was condensed
to a single line (s/\n/\\n/g) for logging.

- Garret

On Fri, Nov 20, 2009 at 8:02 AM, Garret Heaton <powdaho...@gmail.com> wrote:

> The following pattern works for me:
>
> # Record errors
> type=Single
> ptype=RegExp
> pattern=^\[(\w+)\] \[(.+)\] ERROR: (.+)$
> desc=Error
> context=my.log
> action=add errors [Error] $3\nTime: $1\nHost: $2\n\n
>
>
>
>
> # Report errors every minute if there are any
>
> type=Calendar
>
> time=* * * * *
>
> desc=Mail web errors
>
> context=errors
>
> action=report errors /usr/local/bin/notify_script; \
>
>
>        delete errors;
>
>
> I'm using SEC 2.4.2 on Ubuntu 9.04.
>
> - Garret
>
> On Thu, Nov 19, 2009 at 9:41 PM, <da...@lang.hm> wrote:
>
>> I am creating rules that accumulate log lines into a context for a later
>> report.
>>
>> since these are _long_ log lines, they will wrap in the e-mail client when
>> I send them. I would like to add an extra newline when I add text to the
>> context, but I cannot figure out how to make this work.
>>
>> any suggestions?
>>
>> David Lang
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Simple-evcorr-users mailing list
>> Simple-evcorr-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
>>
>
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to