From: | "Fontenot, Paul" <Paul(dot)Fontenot(at)bannerhealth(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | |
Date: | 2003-05-26 18:14:33 |
Message-ID: | 230BCAB977308F43BD851AFAE55A86410AA6B0@phx01018.bannerhealth.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ugh, would someone be so kind as to explain to me what I have missed in
this setup? I have my table (syslogtb), and when a PIX log entry - in
this case the entry is "%PIX-3-305005 blah_blah_blah" - I've read what I
can and thought that I had it understood HOWEVER... When I load the
function and set the trigger I no longer get any inserts into the
database. I have included the table layout, the function, the trigger,
and an example log entry from the PIX.
###
### Table syslog.syslogtb
###
create table syslogtb (
facility char(10),
priority char(10),
date date,
time time,
host varchar(128),
message text
);
###
### Function
###
create function SyslogMail() returns opaque as '
DECLARE
logRec RECORD;
textMessage text;
BEGIN
select into logRec date,time,message from syslogtb where message
= NEW.message;
if logRec.message like ''%PIX-3-305005%'' then
textMessage := ''The following log entry was recieved
from the PIX:'' || logRec.date, logRec.time, logRec.message;
perform pgmail(''Syslog <some_email_addy>'',''Paul
<my_email_addy>'',''PIX Event'', textMessage);
end if;
return NEW;
END;' language 'plpgsql';
###
### Trigger
###
CREATE TRIGGER trgSyslogMail
AFTER INSERT ON syslogtb FOR EACH ROW
EXECUTE PROCEDURE SyslogMail();
###
### Example PIX log entry
###
facility | priority | date | time | host
| message
------------+------------+------------+----------+----------------------
---+-------------------------------------
local6 | err | 2003-05-26 | 13:10:11 |
XXXXXX.XXXXXXXXXXXX.XXX | %PIX-3-305005: No translation group found for
tcp src outside:63.136.222.30/62503 dst inside:xxx.xxx.xx.x/80
HOPEFULLY, I've explained that well enough and thanks for your help in
advance.
From | Date | Subject | |
---|---|---|---|
Next Message | Jon Earle | 2003-05-26 18:27:16 | Re: French Characters |
Previous Message | PeterKorman | 2003-05-26 17:52:53 | Re: Slashdot: SAP and MySQL Join Forces |