How to send from Tomcat log (catelina.out) to Syslog?


 
Thread Tools Search this Thread
Operating Systems Linux How to send from Tomcat log (catelina.out) to Syslog?
# 1  
Old 05-30-2011
Hammer & Screwdriver How to send from Tomcat log (catelina.out) to Syslog?

Dear AllSmilie

We want to send log message from Tomcat Log to Syslog. So we have configured as follows:

Our environment: Tomcat 5.5 with CentOS 5.6 Final version (32Bit)

log4j.properties file location:
/usr/share/tomcat5/common/classes

log4j-1.2.16.jar and commons-logging-1.1.1.jar file location:
/usr/share/tomcat5/common/lib

log4j.properties file contents:
Code:
[root@CENTOSTESTER classes]# cat log4j.properties
log4j.rootLogger=WARN, file, SYSLOG
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.append=true
log4j.appender.file.File=/var/log/tomcat5/tomcat.log
log4j.appender.file.MaxFileSize=5MB
log4j.appender.file.maxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{DATE} - [%t] - %C{1}.%M(%L) - %p: %m%n
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.SyslogHost=127.0.0.1
log4j.appender.SYSLOG.Facility=LOCAL0
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%-4r %-5p %c{2} %M.%L %x - %m\n
log4j.appender.SYSLOG.threshold=DEBUG
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=FATAL
# OpenSymphony Stuff
log4j.logger.net.apache.framework=DEBUG
log4j.logger.net.apache=DEBUG
log4j.logger.org.apache.struts2=ERROR
log4j.logger.org.hibernate.type=ERROR
log4j.logger.org.hibernate.SQL=ERROR
[root@CENTOSTESTER classes]#


In Syslog we have this entry for tomcat logs:
/etc/syslog.conf file

Code:
# syslog server's ip address
*.*     @192.168.10.13

Tomcat service and Syslog service restarted.

Created folder in /var/logs/tomcat5:
Tomcat.log file. But there is no data in tomcat.log file.

And Syslog server can't the syslog. Apart of Tomat log, another log message is received.

How to solve?

Thank you in advance.

Last edited by pludi; 05-30-2011 at 05:05 AM..
ziosnim
# 2  
Old 05-31-2011
@ in syslog says forward the syslog packets. You want remote logging?
# 3  
Old 06-04-2011
2 things to check:

1. You mentioned the /var/log/tomcat5/ directory. Did you create /var/log/tomcat5/ or /var/log/tomcat5? Note also that it'll need to be writable by whatever user is running Tomcat/log4j.

2. Is your syslog daemon configured to accept events over IP sockets (bind to a port), and not just locally (ie, /dev/log)? You might test that by generating an event with "logger" and see whether that appears in the system syslog and/or your remote log host. Instructions at http://help.papertrailapp.com/kb/configuration/generate-a-test-remote-syslog-message

It could also be that log4j isn't receiving any messages, but that config looks sane at first pass.

If you want to test with a known-good syslog receiver, make a free account at http://papertrailapp.com/ and add a system. You'll get a hostname that you can log to, and should be able to drop that into the SyslogAppender then see your messages appear. If you don't see messages appearing, they aren't being generated.
This User Gave Thanks to troyd For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Cannot send syslog event from AIX 6.1 to RHEL Syslog server

Hi everyone, I am trying to configure AIX 6.1 using syslogd to send syslog event to syslog server configured on RHEL. However, RHEL never receives the events. I have tried to redirect the syslog event on AIX to a local file and successful. Only forwarding to remote server fails. Firewall... (10 Replies)
Discussion started by: michael_hoang
10 Replies

2. HP-UX

Send Audit Events to Syslog

Hi guys, I am currently runnig hp-ux v11.3. I have enabled auditing and I am able to send the audit events to a text file in syslog format using the following command: audisp -r /var/.audit/audtrail/auditfile -P -o follow -O sync | audit_p2l > /var/adm/auditlog I am required to send the... (0 Replies)
Discussion started by: peter maisiba
0 Replies

3. Solaris

How can i send Solaris syslog loging server?

HI how can i send solaris syslog to centralized logging server? i have tried adding like below and got error: *.err;kern.debug;daemon.notice;mail.crit @172.16.200.50:5000 and the error i got in /var/adm/messages is: Jun 10 13:02:24 aresdb-new.alshaya.com syslogd: line 14:... (10 Replies)
Discussion started by: bentech4u
10 Replies

4. Linux

How to push Tomcat logs to remote syslog server?

I found a script for automatically push tomcat logs to syslog server which is locate in same server. How do I change it to push logs to remote server? log4j.rootLogger=INFO, WARN, console, file, SYSLOG log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.append=true... (2 Replies)
Discussion started by: heshandh
2 Replies

5. Solaris

Tomcat..Unable to deploy application remotely in tomcat

Hi, We have upgrade tomcat from 5.0.20 to 7.0.33 and made changes to server.xml file according to newer version.. how ever the upgrade went fine and now i am unable to deploy application remotely.. it is giving 403 access denied error.. we have seperate appbase directory mentioned in server.xml..... (0 Replies)
Discussion started by: phani4u
0 Replies

6. Shell Programming and Scripting

Tomcat Monitoring log file

Hi, I ned to monitor the tomcat log file called "catalina.out" for "OutOfMemory" ,"java.sql.SQLException" and "Error" error. the script should monitor this file (catalina.out) and send us the mail as soon as it finds the string "Out of memory" or "java.sql.SQLException" or "Error" in the... (2 Replies)
Discussion started by: mnmonu
2 Replies

7. Shell Programming and Scripting

Tomcat log file in date format

Hi, I was asked to write a new logrotate file for tomcat logs..in which one of the requirement is to have date and time appended at the end of the file name. I have tried dateext and dateformat-%Y-%m-%d-%s but these directives didn't have the option for HH:MM. I am very new to this... (2 Replies)
Discussion started by: sdspawankumar
2 Replies

8. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

9. Emergency UNIX and Linux Support

monitor log entries and send e-mail

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! I am stuck and worried. My assignment was due a day ago and I was too busy completing other assignments due during the same time. I worry that not completing this assignment... (1 Reply)
Discussion started by: vin8465
1 Replies

10. Red Hat

Configure Tomcat to syslog

Hi ALL, Thanks for previous replies.. This thread is regarding tomcat logs -> Syslog Server. I have followed this doc:- Red Hat Knowledgebase: How do I log Tomcat output to a remote syslog server? But no success.. any clues? Thanks alot! Sudhir (3 Replies)
Discussion started by: sidhurana
3 Replies
Login or Register to Ask a Question