syslog-java-client

Syslog Java Client

License

License

Categories

Categories

Java Languages CLI User Interface
GroupId

GroupId

com.cloudbees
ArtifactId

ArtifactId

syslog-java-client
Last Version

Last Version

1.1.7
Release Date

Release Date

Type

Type

jar
Description

Description

syslog-java-client
Syslog Java Client
Project URL

Project URL

https://github.com/CloudBees-community/syslog-java-client
Source Code Management

Source Code Management

https://github.com/CloudBees-community/syslog-java-client

Download syslog-java-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.cloudbees/syslog-java-client/ -->
<dependency>
    <groupId>com.cloudbees</groupId>
    <artifactId>syslog-java-client</artifactId>
    <version>1.1.7</version>
</dependency>
// https://jarcasting.com/artifacts/com.cloudbees/syslog-java-client/
implementation 'com.cloudbees:syslog-java-client:1.1.7'
// https://jarcasting.com/artifacts/com.cloudbees/syslog-java-client/
implementation ("com.cloudbees:syslog-java-client:1.1.7")
'com.cloudbees:syslog-java-client:jar:1.1.7'
<dependency org="com.cloudbees" name="syslog-java-client" rev="1.1.7">
  <artifact name="syslog-java-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.cloudbees', module='syslog-java-client', version='1.1.7')
)
libraryDependencies += "com.cloudbees" % "syslog-java-client" % "1.1.7"
[com.cloudbees/syslog-java-client "1.1.7"]

Dependencies

compile (1)

Group / Artifact Type Version
com.github.spotbugs : spotbugs-annotations Optional jar 3.1.10

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-all jar 1.3

Project Modules

There are no modules declared in this project.

Syslog Java Client

Description

Client library written in Java to send messages to a Syslog server.

Release Notes and downloads

See https://github.com/CloudBees-community/syslog-java-client/releases/

Using the Syslog Java Client with Maven

Add the following dependency in your pom.xml:

<dependency>
    <groupId>com.cloudbees</groupId>
    <artifactId>syslog-java-client</artifactId>
    <version>1.1.7</version>
</dependency>

Sample UDP sender using RFC 3164

import com.cloudbees.syslog.Facility;
import com.cloudbees.syslog.MessageFormat;
import com.cloudbees.syslog.Severity;
import com.cloudbees.syslog.sender.UdpSyslogMessageSender;

...

// Initialise sender
UdpSyslogMessageSender messageSender = new UdpSyslogMessageSender();
messageSender.setDefaultMessageHostname("myhostname"); // some syslog cloud services may use this field to transmit a secret key
messageSender.setDefaultAppName("myapp");
messageSender.setDefaultFacility(Facility.USER);
messageSender.setDefaultSeverity(Severity.INFORMATIONAL);
messageSender.setSyslogServerHostname("127.0.0.1");
// syslog udp usually uses port 514 as per https://tools.ietf.org/html/rfc3164#page-5
messageSender.setSyslogServerPort(514);
messageSender.setMessageFormat(MessageFormat.RFC_3164); // optional, default is RFC 3164

// send a Syslog message
messageSender.sendMessage("This is a test message");

Sample UDP sender using RFC 5424

import com.cloudbees.syslog.Facility;
import com.cloudbees.syslog.MessageFormat;
import com.cloudbees.syslog.Severity;
import com.cloudbees.syslog.sender.UdpSyslogMessageSender;

...

// Initialise sender
UdpSyslogMessageSender messageSender = new UdpSyslogMessageSender();
messageSender.setDefaultMessageHostname("myhostname"); // some syslog cloud services may use this field to transmit a secret key
messageSender.setDefaultAppName("myapp");
messageSender.setDefaultFacility(Facility.USER);
messageSender.setDefaultSeverity(Severity.INFORMATIONAL);
messageSender.setSyslogServerHostname("127.0.0.1");
messageSender.setSyslogServerPort(1234);
messageSender.setMessageFormat(MessageFormat.RFC_5424);

// send a Syslog message
messageSender.sendMessage("This is a test message");

Sample TCP sender using RFC 3164

import com.cloudbees.syslog.Facility;
import com.cloudbees.syslog.MessageFormat;
import com.cloudbees.syslog.Severity;
import com.cloudbees.syslog.sender.TcpSyslogMessageSender;

...

// Initialise sender
TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
messageSender.setDefaultMessageHostname("myhostname"); // some syslog cloud services may use this field to transmit a secret key
messageSender.setDefaultAppName("myapp");
messageSender.setDefaultFacility(Facility.USER);
messageSender.setDefaultSeverity(Severity.INFORMATIONAL);
messageSender.setSyslogServerHostname("127.0.0.1");
messageSender.setSyslogServerPort(1234);
messageSender.setMessageFormat(MessageFormat.RFC_3164); // optional, default is RFC 3164
messageSender.setSsl(false);

// send a Syslog message
messageSender.sendMessage("This is a test message");

Sample TCP over SSL sender using RFC 3164

import com.cloudbees.syslog.Facility;
import com.cloudbees.syslog.MessageFormat;
import com.cloudbees.syslog.Severity;
import com.cloudbees.syslog.sender.TcpSyslogMessageSender;

...

// Initialise sender
TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
messageSender.setDefaultMessageHostname("myhostname"); // some syslog cloud services may use this field to transmit a secret key
messageSender.setDefaultAppName("myapp");
messageSender.setDefaultFacility(Facility.USER);
messageSender.setDefaultSeverity(Severity.INFORMATIONAL);
messageSender.setSyslogServerHostname("127.0.0.1");
messageSender.setSyslogServerPort(1234);
messageSender.setMessageFormat(MessageFormat.RFC_3164); // optional, default is RFC 3164
messageSender.setSsl(true);

// send a Syslog message
messageSender.sendMessage("This is a test message");

Sample TCP over SSL sender using RFC 5425

import com.cloudbees.syslog.Facility;
import com.cloudbees.syslog.MessageFormat;
import com.cloudbees.syslog.Severity;
import com.cloudbees.syslog.sender.TcpSyslogMessageSender;

...

// Initialise sender
TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
messageSender.setDefaultMessageHostname("myhostname"); // some syslog cloud services may use this field to transmit a secret key
messageSender.setDefaultAppName("myapp");
messageSender.setDefaultFacility(Facility.USER);
messageSender.setDefaultSeverity(Severity.INFORMATIONAL);
messageSender.setSyslogServerHostname("127.0.0.1");
// syslog-tls usually uses port 6514 as per https://tools.ietf.org/html/rfc5425#page-11
messageSender.setSyslogServerPort(6514);
messageSender.setMessageFormat(MessageFormat.RFC_5425);
messageSender.setSsl(true);

// send a Syslog message
messageSender.sendMessage("This is a test message");
com.cloudbees

CloudBees Community

Versions

Version
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0