AWS request handler for logging call details.

This is a library that can be used to various details about an AWS call in a log file

License

License

Categories

Categories

AWS Container PaaS Providers
GroupId

GroupId

cloud.cirrusup
ArtifactId

ArtifactId

aws-latency-request-log-handler
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

AWS request handler for logging call details.
This is a library that can be used to various details about an AWS call in a log file
Project URL

Project URL

https://github.com/cirrus-up-cloud/aws-latency-request-log-handler
Source Code Management

Source Code Management

http://github.com/cirrus-up-cloud/aws-latency-request-log-handler

Download aws-latency-request-log-handler

How to add to project

<!-- https://jarcasting.com/artifacts/cloud.cirrusup/aws-latency-request-log-handler/ -->
<dependency>
    <groupId>cloud.cirrusup</groupId>
    <artifactId>aws-latency-request-log-handler</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/cloud.cirrusup/aws-latency-request-log-handler/
implementation 'cloud.cirrusup:aws-latency-request-log-handler:1.1.0'
// https://jarcasting.com/artifacts/cloud.cirrusup/aws-latency-request-log-handler/
implementation ("cloud.cirrusup:aws-latency-request-log-handler:1.1.0")
'cloud.cirrusup:aws-latency-request-log-handler:jar:1.1.0'
<dependency org="cloud.cirrusup" name="aws-latency-request-log-handler" rev="1.1.0">
  <artifact name="aws-latency-request-log-handler" type="jar" />
</dependency>
@Grapes(
@Grab(group='cloud.cirrusup', module='aws-latency-request-log-handler', version='1.1.0')
)
libraryDependencies += "cloud.cirrusup" % "aws-latency-request-log-handler" % "1.1.0"
[cloud.cirrusup/aws-latency-request-log-handler "1.1.0"]

Dependencies

compile (7)

Group / Artifact Type Version
com.amazonaws : aws-java-sdk-core jar 1.11.397
com.amazonaws : aws-java-sdk-s3 jar 1.11.397
com.fasterxml.jackson.core : jackson-core jar 2.9.7
org.slf4j : slf4j-api jar 1.7.5
org.slf4j : jcl-over-slf4j jar 1.7.5
junit : junit jar 4.12
org.mockito : mockito-core jar 2.0.5-beta

runtime (1)

Group / Artifact Type Version
org.slf4j : slf4j-simple jar 1.7.5

test (3)

Group / Artifact Type Version
org.powermock : powermock-api-mockito jar 1.6.2
org.powermock : powermock-module-junit4 jar 1.6.2
org.powermock : powermock-core jar 1.7.0

Project Modules

There are no modules declared in this project.

Maven Central

AWS Latency request log handler

Description

This library exposes a simple but very efficient AWS request handler that log in a text files various details about your AWS calls.

How to use it

i. Declare the dependency in your pom.xml file.

<dependency>
  <groupId>cloud.cirrusup</groupId>
  <artifactId>aws-latency-request-log-handler</artifactId>
  <version>1.1.0</version>
</dependency>

ii. Create a request handler object.

AwsLatencyRequestLogHandler handler = new AwsLatencyRequestLogHandler();

If you want to publish call details in JSON format, then declare the handler in the following manner:

AwsLatencyRequestLogHandler handler = new AwsLatencyRequestLogHandler(new JSONPublisher());

iii. Enhance the AWS client with the request handler created above.

amazonS3Client.addRequestHandler(handler);    

iv. Create a log appender named aws-latency-log.

  <appender name="AWS-APPENDER-LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>/var/log/awsLatency.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <!-- hourly rollover -->
      <fileNamePattern>/var/log/awsLatency/awsLatency.%d{yyyy-MM-dd-HH}.log</fileNamePattern>
      <!-- keep 2 days' worth of history capped at 500MB total size -->
      <maxHistory>2</maxHistory>
      <totalSizeCap>500MB</totalSizeCap>
    </rollingPolicy>
    <encoder>
      <pattern>[%thread] %-5level - %d{yyyy-MM-dd HH:mm:ss} - %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>[%thread] %-5level - %d{yyyy-MM-dd HH:mm:ss} - %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

Versions

Version
1.1.0
1.0.0