Push JIRA logs to syslog server

Heshan Manamperi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 7, 2014

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

2 answers

1 accepted

3 votes
Answer accepted
Aleš Laňar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 2, 2014

Hi Heshan,

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

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 7, 2015

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

John Doe November 25, 2015

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

Deleted user November 15, 2019

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

4 votes
Heshan Manamperi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2015

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

Deleted user November 13, 2019

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