I need to send logs from clients to a server following this steps:
- mysql writings must be done once datas are received via RELP protocol not via mysql output module.
- server-side, datas received from hosts, must be written in database only, not in logfile.
So I simply added client-side these lines in the rsyslog.conf file:
- Code: Select all
$ModLoad omrelp.so
*.* :omrelp:svr_ip_addr:20514;RSYSLOG_TraditionalFileFormat
And server-side:
- Code: Select all
$ModLoad imrelp.so
$ModLoad ommysql.so
# Start RELP Server
$InputRELPServerRun 20514
# Store logs in mysql
*.* :ommysql:localhost,dbName,dbUser,dbPwd
Server-side everything is correctly recorded on disk and database , but I don't want the client logs to be record on disk.
I know the basic schema is to do something like:
- Code: Select all
# logs everything from localhost and clients to database
*.* :ommysql:localhost,dbName,dbUser,dbPwd
# only keep localhost logs in /var/log/right_log_files
if $source == 'localhost' then "do local things"
However, I don't get the 'localhost' value in my logfiles but the hostname . So is there a property from rsyslog to access the server hostname without hard-coding it's name.
Regards,
TCL

