Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Can Oracle write to syslog?
On Fri, 19 Nov 2004 19:52:12 +0100, Sybrand Bakker said something similar to:
: On 19 Nov 2004 06:43:42 -0800, fahdshariff_at_yahoo.com (Fahd Shariff)
: wrote:
:
: >Is it possible to send messages from Oracle to the syslog daemon which
: >ultimately writes to the file /var/adm/messages?
:
: As there is an alert log there is little need for it.
It may not be strictly nessecary, but it can be useful. Particularly when syslog is use to direct all logs to a central monitoring system.
: Other than that
: you could write an external procedure call in the Unix API to write to
: the syslog, and hook that up to the external procedure listener.
Easier way:
#!/bin/sh
ALERT_LOG=/path/to/alert/log
ORACLE_SID=your_sid
FACILITY=local0
PRIORITY=notice
tail -f ${ALERT_LOG} | egrep -v \
'^[A-Z][a-z]{2} [A-Z][a-z]{2} [ 1-3][1-9] [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}$'\
| logger -t oracle/${ORACLE_SID} -p ${FACILITY}.${PRIORITY}
Season to taste and set your system's init scripts to start the script in the background at boot.
Personally, the fact that syslog puts the date stamp on the same line as the message rather than on a line by itself makes this exercise worthwhile. It's alot easier to dig information out of the log with grep that way. Received on Wed Nov 24 2004 - 17:45:29 CST