Viskan Distanshandel System AB :: Logstash Appender

Appends logs to Logstash in a very friendly JSON format.

License

License

Categories

Categories

Logstash Application Layer Libs Logging
GroupId

GroupId

com.viskan
ArtifactId

ArtifactId

logstash-appender
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

bundle
Description

Description

Viskan Distanshandel System AB :: Logstash Appender
Appends logs to Logstash in a very friendly JSON format.
Project URL

Project URL

https://github.com/viskan/logstash-appender
Project Organization

Project Organization

Viskan Distanshandel System AB
Source Code Management

Source Code Management

https://github.com/viskan/logstash-appender

Download logstash-appender

Dependencies

compile (1)

Group / Artifact Type Version
org.apache.logging.log4j : log4j-core jar 2.8.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

logstash-appender

Maven Central

A simple log4j appender that sends a JSON-object to a Logstash server.

Where can I find the releases?

You can pull it from the central Maven repositories:

<dependency>
	<groupId>com.viskan</groupId>
	<artifactId>logstash-appender</artifactId>
	<version>1.1.0</version>
</dependency>

Usage: logstash configuration

A simple example of the logstash server configuration:

input {
	udp {
		port => 12345
		codec => "json"
	}
}
output {
	elasticsearch {
		protocol => http
		host => "localhost"
		port => 9200
	}
}

Usage: log4j configuration

As a plain properties file:

# Logstash appender
log4j.appender.Logstash=com.viskan.logstash.appender.LogstashAppender
log4j.appender.Logstash.Threshold=INFO
log4j.appender.Logstash.application=SomeApplication
log4j.appender.Logstash.logstashHost=hostname.com
log4j.appender.Logstash.logstashPort=12345
log4j.appender.Logstash.mdcKeys=httpMethod, httpPath, responseTime, responseCode
log4j.appender.Logstash.appendClassInformation=false

Add appender to OSGi environment (Karaf)

First of all, you need to add the JAR as a system bundle. Add logstash-appender-1.1.0.jar to /system/com/viskan/logstash-appender/1.1.0/logstash-appender-1.1.0.jar. Then you need to add it to the startup flow. Edit /etc/startup.properties so it looks something like this:

#
# Startup core services like logging
#
org/ops4j/pax/url/pax-url-mvn/1.3.5/pax-url-mvn-1.3.5.jar=5
org/ops4j/pax/url/pax-url-wrap/1.3.5/pax-url-wrap-1.3.5.jar=5
org/ops4j/pax/logging/pax-logging-api/1.7.0/pax-logging-api-1.7.0.jar=8
org/ops4j/pax/logging/pax-logging-service/1.7.0/pax-logging-service-1.7.0.jar=8
com/viskan/logstash-appender/1.1.0/logstash-appender-1.1.0.jar=8
org/apache/felix/org.apache.felix.configadmin/1.6.0/org.apache.felix.configadmin-1.6.0.jar=10
org/apache/felix/org.apache.felix.fileinstall/3.2.6/org.apache.felix.fileinstall-3.2.6.jar=11
com.viskan

Viskan System AB

Versions

Version
2.0.0
1.1.0
1.0.0