LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 05-27-2011, 01:03 PM   #1
elorson
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

Thanks,
Eric
 
Old 05-29-2011, 12:56 AM   #2
vkvs
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:
Code:
CustomLog |/usr/bin/apache_syslog syslog
ErrorLog |/usr/bin/apache_syslog
/usr/bin/apache_syslog:
Code:
#!/usr/bin/perl
use Sys::Syslog qw( :DEFAULT setlogsock );

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

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

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

Last edited by vkvs; 05-29-2011 at 12:57 AM.
 
  


Reply


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 09:38 PM
support of third party tools logs in syslog/rsyslog Raheel Hassan Linux - Security 2 08-23-2010 11:30 AM
rsyslog sometimes logs fqdn, sometimes just host name whysyn Linux - Software 3 06-03-2008 11:31 AM
apache is writing empty logs ocularbob Linux - Software 1 07-03-2003 03:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:21 AM.

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