Tuesday, June 12, 2012

How-to: Configure and Install Syslog-ng on centos 5 tutorial

Download and grab one version which has too tar files, one is lib called eventlog, another one is syslog.
image

compile and install eventlog lib which is required by syslog-ng,
image

once done, you can find the bit under /usr/local/share/pkgconfig
image

now export the path to the variable, PKG_CONFIG_PATH and configure syslog
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
otherwise you get error when you configure the syslog,
image

then ./configure && make && make install
you can run /usr/local/sbin/syslong-ng –V to show the version  information.
By default, syslog-ng.conf is located under /usr/share/etc

then change the conf file as the following, we will parse two sources one is from file, another from the syslog client. we will use nc as the testing client,

@version: 3.3
@include "scl.conf"
source localudp  {
        file('/tmp/inputtest.txt');
        udp();
};
destination f_local {
        file("/var/log/messages.txt");
};
log {
        source(localudp);

        destination(f_local);
};

then start the server in forground, syslog-ng –F
touch and put some words in the input file, you can tell the message was dumped to the destination.
image

test some stuff using nc,
image

1 comment:

r2d2 said...

for example if i want forward the log to kiwisyslog server, the instructions on syslog-ng must be the same like you did?

 
Locations of visitors to this page