It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Push JIRA logs to syslog server

I need to push JIRA logs (tomcat logs) to remote syslog server.

2 answers

1 accepted

3 votes
Answer accepted

Hi Heshan,

Try to use syslog appender. In log4j properties you add it and then you have to insert DNS SERVER NAME.... :)

It would be great if you could provide more information regarding enabling syslog appender.

Do you have a sample code that we can use as a guideline? Thanks

Do you know how can i add hostname/ip address on each syslog line from jira application log? 
Following is my log4j confg:

log4j.rootLogger=WARN, filelog, SYSLOG

log4j.appender.SYSLOG.threshold=WARN
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.syslogHost=127.0.0.1
log4j.appender.SYSLOG.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%t %5r %-5p %-21d{yyyyMMdd HH:mm:ss,SSS} %c{2} [%x] %m %throwable{none}
log4j.appender.SYSLOG.Facility=local0

 
Above config +dns config is generating following logs but missing the hostname. I have copied 3 syslog lines in here.

Nov 15 14:19:10 http-nio-8080-exec-2950 1096259174 WARN 20191115 14:19:10,743 runner.AbstractScriptRunner [null] Hello this is a test log message
Nov 15 14:19:10 http-nio-8080-exec-2950 1096259174 WARN 20191115 14:19:10,743 runner.AbstractScriptRunner [null] Hello this is a test log message
Nov 15 14:19:10 http-nio-8080-exec-2950 1096259174 WARN 20191115 14:19:10,743 runner.AbstractScriptRunner [null] Hello this is a test log message

You need to modify log4j.property file.

Add SYSLOG to log4j.rootCategory.

Ex:

# sample properties to initialize

log4j log4j.rootCategory= WARN, console, filelog, SYSLOG, fout


Then add below appender to this file

log4j.appender.SYSLOG.threshold=WARN 
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender 
log4j.appender.SYSLOG.syslogHost=<IP address of local syslog server>
log4j.appender.SYSLOG.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%t %5r %-5p %-21d{yyyyMMdd HH:mm:ss,SSS} %c{2} [%x] %m %throwable{none}
log4j.appender.SYSLOG.Facility=LOCAL0


Then go to /etc/syslog-ng/syslog-ng.conf file

Un-comment below line udp(ip("0.0.0.0") port(514));


and add below lines

destination df_remote_log { udp("<IP address of remote syslog server>" port(514)); };
filter f_mit { facility(LOCAL0); };
log {
source(src);
filter(f_mit); destination(df_remote_log);
};

Finally restart tomcat and syslog services

Hi Heshan,

can you please let me know how to add hostname on each syslog line? I have followed the instruction but we don't get hostname/ source ip address.


Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you