i would like to share my notes about using rsyslog with omoracle:
REQUIREMENTS:
- Oracle Instantclient 10g (NOT 11g) Base + Devel (if you´re on 64-bit linux you should choose the 64-bit libs!)
You can download the client from here: http://www.oracle.com/technology/softwa ... index.html
- JDK 1.6 (not neccessary for oracle plugin but "make" did not finsished successfully without it)
- "oracle-instantclient-config" script .. you have to adjust "incdirs" and "libdirs" according to your env
(seems to shipped with instantclient 10g Release 1 but i was unable to find it for 10g Release 2 so here it is)
====================== /usr/local/bin/oracle-instantclient-config =====================
- Code: Select all
#!/bin/sh
#
# Oracle InstantClient SDK config file
# Jean-Christophe Duberga - Bordeaux 2 University
#
# just adapt it to your environment
incdirs="-I/usr/include/oracle/10.2.0.4/client64"
libdirs="-L/usr/lib/oracle/10.2.0.4/client64/lib"
usage="\
Usage: oracle-instantclient-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
if test $exec_prefix_set = no ; then
exec_prefix=$optarg
fi
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo ${exec_prefix}
;;
--version)
echo ${version}
;;
--cflags)
echo ${incdirs}
;;
--libs)
echo $libdirs -lclntsh -lnnz10 -locci -lociei -locijdbc10
;;
--static-libs)
echo "No static libs" 1>&2
exit 1
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done
=============== END ==============
COMPILING RSYSLOGD
- Code: Select all
./configure --enable-oracle
RUNNING
- make sure rsyslogd is able to locate the oracle libs (either via LD_LIBRARY_PATH or /etc/ld.so.conf)
- set TNS_ADMIN to point to your tnsnames.ora
- create a tnsnames.ora and test you are able to connect to the database
- create user in oracle as shown in the following example:
- Code: Select all
create user syslog identified by syslog default tablespace users quota unlimited on users;
grant create session to syslog;
create role syslog_role;
grant syslog_role to syslog;
grant create table to syslog_role;
grant create sequence to syslog_role;
- create tables as needed
- configure rsyslog as shown in the following example
- Code: Select all
$ModLoad omoracle
$OmoracleDBUser syslog
$OmoracleDBPassword syslog
$OmoracleDB syslog
$OmoracleBatchSize 1
$OmoracleBatchItemSize 4096
$OmoracleStatementTemplate OmoracleStatement
$template OmoracleStatement,"insert into foo(hostname,message) values (:host,:message)"
$template TestStmt,"%hostname%%msg%"
*.* :omoracle:;TestStmt
(you guess it: username = password = database = "syslog".... see $rsyslogd_source/plugins/omoracle/omoracle.c for me info)
If you have any additions please give me a feedback.

