- CloudWatch Logs: basic centralized log management, providing keyword and time range search.
- Kinesis Streams: the first step in a logging pipeline that feeds Elasticsearch and other analytics destinations.
- SNS: useful for real-time error notifications.
In addition, this library provides the following features:
- JsonLayout, which lets you send data to an Elasticsearch/Kibana cluster without the need for parsing.
- JMX integration, which allows the appenders to report operational data.
- Substitions, which allow you to configure the appenders with information from the runtime environment, such as EC2 instance ID.
To use these appenders, include the framework-specific appenders JAR in your project, along with the JAR(s) specific to your logging framework and the relevant AWS JAR(s) as described below.
The appender JARs are published on Maven Central. You can find the latest version from the following links:
See the documentation for each appender for configuration. You can also look at the example projects.
I follow the standard
MAJOR.MINOR.PATCH versioning scheme:
MAJORis currently 2, representing the split from single-framework library to front- and back-end libraries supporting multiple frameworks.
MINORis incremented for each change that adds signficant functionality or changes the behavior of existing functionality in non-backwards-compatible ways. The API does not break backwards compatibility for minor releases, so your configurations can remain the same.
PATCHis incremented for bugfixes or minor additions to existing features.
To avoid dependency hell, all dependencies are marked as "provided": you will need to ensure that your project includes necessary dependencies for your destination(s).
- Your logging framework of choice
aws-java-sdk-iamto use assumed roles.
aws-java-sdk-ssmto use the
aws-java-sdk-ststo use assumed roles or the
The minimum supported dependency versions are:
Log4J 1.x: 1.2.16
This is the first version that implements
LoggingEvent.getTimeStamp(), which is needed to order messages when sending to AWS. It's been around since 2010, so if you haven't upgraded already you should.
Log4J 2.x: 2.10.0
This is the first version that supports custom key/value pairs for
JsonLayout. If that's not important to you, the library will work with version 2.8 (which introduced a breaking change in backwards compatibility).
This version is required to support
JsonAccessLayout. If you don't use that, version 1.0.0 will work.
AWS SDK: 1.11.0
The appenders will work with all releases in the 1.11.x sequence, but some features require later versions (eg, to access values from Parameter Store, you need 1.11.63). If you're using a version that has client builders, they will be used to create service clients; if not, the default client constructors are used. For more information, see the FAQ.
Note: this library does not support the AWS SDK for Java 2.0. If you use that SDK, you will also need to include the JARs for the 1.x SDK to support this library.
I have made an intentional effort to limit dependencies to the bare minimum. This has in some cases meant that I write internal implementations for functions that are found in common libraries.
At this time I am not accepting contributions. If you find a bug in the code, please submit an issue that explains the problem and includes the filename and line number (or better, a link to the source) where the error exists.
For more information
If you want to build it yourself, read this