Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-27-2011, 12:03 PM   #1
LQ Newbie
Registered: May 2011
Posts: 1

Rep: Reputation: Disabled
Redirecting Apache/Tomcat Logs to rsyslog without writing to disk....

For internal security reasons I need to prevent our tomcat logs from writing to the webserver local disk. We set up a separate logging server with rsyslog and need to pipe the log data to it.

I am trying to work out how to configure tomcat to send all log data to the logging server via the rsyslog client (running locally) via a named pipe.

We are on CentOS 5.6, Tomcat 6 and rsyslog 5.8.1.

I need to know:
1) do we use the default logging library or log4j
2) where is this configured in the tomcat config
3) is there any code that would need to be written to achieve this

Old 05-28-2011, 11:56 PM   #2
LQ Newbie
Registered: May 2011
Posts: 23

Rep: Reputation: 2
Thats how I currently have it set: apache writes to a regular log file, sends a copy to rsyslog, rsyslog sends it to remote server.

How to set:

In vhosts directive:
CustomLog |/usr/bin/apache_syslog syslog
ErrorLog |/usr/bin/apache_syslog
use Sys::Syslog qw( :DEFAULT setlogsock );

openlog('apache', 'cons,pid', 'local2');

while ($log = <STDIN>) {
            syslog('notice', "HTTPD $log");

Of course this requires syslog defined in apache, or use common/combined. Enjoy!

Last edited by vkvs; 05-28-2011 at 11:57 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I define how old logs should rsyslog keep? craseal Linux - Server 1 08-25-2010 08:38 PM
support of third party tools logs in syslog/rsyslog Raheel Hassan Linux - Security 2 08-23-2010 10:30 AM
rsyslog sometimes logs fqdn, sometimes just host name whysyn Linux - Software 3 06-03-2008 10:31 AM
apache is writing empty logs ocularbob Linux - Software 1 07-03-2003 02:26 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration