How to send message to a syslog
Answer:
Basically you need to use the logger command, e.g.
logger "have fun with logger"
You will find the log went to /var/log/messages
Jan 15 23:08:34 www john: have fun with logger
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to send message to a syslog
Answer:
Basically you need to use the logger command, e.g.
logger "have fun with logger"
You will find the log went to /var/log/messages
Jan 15 23:08:34 www john: have fun with logger
Sending Apache log to syslog?
Answer:
In the Apache config (httpd.conf), add/modify the followings as needed
1. For Access log
CustomLog |/usr/local/apache/bin/apache_syslog combined
Where apache_syslog is a Perl script
#!/usr/bin/perl
use Sys::Syslog qw( :DEFAULT setlogsock );
setlogsock('unix');
openlog('apache', 'cons', 'pid', 'local2');
while ($log = ) {
syslog('notice', $log);
}
closelog
2. For Error log
Apache already has direct support error log to syslog, so just add the target syslog facility.
ErrorLog syslog:local1
This tells Apache to send the error log output to the syslog facility local1
Why am I seeing "-- Mark --" in my syslog?
Answer:
This is a timestamp which is automatically generated by syslogd, and is syslogd's way of stating that it has nothing to report. The default interval between two -- MARK -- lines is 20 minutes.
This can be changed by locating the syslodg startup script, and changing the parmeter after the "-m" option to suit your needs. To disable these timestamps completely, set "-m" to 0. For more information, type "man syslogd".