Skip to content

Commit

Permalink
'Version 1.3.0 of the AWS CloudTrail Processing Library'
Browse files Browse the repository at this point in the history
  • Loading branch information
hongjili28 committed Aug 25, 2020
1 parent b37099c commit 98e22a7
Show file tree
Hide file tree
Showing 94 changed files with 441 additions and 139 deletions.
6 changes: 3 additions & 3 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: AWS CloudTrail Processing Library for Java
Bundle-SymbolicName: com.amazonaws.awscloudtrailprocessinglibrary;singleton:=true
Bundle-Version: 1.2.0
Bundle-Version: 1.3.0
Bundle-Vendor: Amazon Technologies, Inc
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: com.amazonaws.sdk;bundle-version="1.11.135"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: com.amazonaws.sdk;bundle-version="1.11.830"
Export-Package: com.amazonaws.services.cloudtrail,
com.amazonaws.services.cloudtrail.processinglibrary,
com.amazonaws.services.cloudtrail.processinglibrary.configuration,
Expand Down
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
AWS CloudTrail Processing Library
Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2014-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
9 changes: 8 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Minimum Requirements
~~~~~~~~~~~~~~~~~~~~

* **AWS Java SDK 1.10.27**: In order to use the |library|, you'll need the `AWS Java SDK`__.
* **Java 1.7**: The |library| requires `Java 1.7 (Java SE 7)`__ or later.
* **Java 1.8**: The |library| requires `Java 1.8 (Java SE 8)`__ or later.

.. __: https://github.com/aws/aws-sdk-java
.. __: http://www.oracle.com/technetwork/java/javase/overview/index.html
Expand Down Expand Up @@ -65,6 +65,13 @@ build, use this command::
Release Notes
-------------

Release 1.3.0 (Jul 30, 2020)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Added support for parsing new section, attributions, in insightContext.
* Added support for parsing new fields, baselineDuration, in statistics section in insightContext.
* Added thread configuration for s3 client, sqs client, and sqs reader to enable performance tuning.
* Updated minimum required Java SE version to 1.8.

Release 1.2.0 (Nov 20, 2019)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Added support for a new eventCategory attribute to indicate whether an event is a management, data, or Insights event.
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ bin.includes = LICENSE.txt,\
META-INF/,\
.

jre.compilation.profile = JavaSE-1.7
jre.compilation.profile = JavaSE-1.8
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>aws-cloudtrail-processing-library</artifactId>
<packaging>jar</packaging>
<name>AWS CloudTrail Processing Library for Java</name>
<version>1.2.0</version>
<version>1.3.0</version>
<description>AWS CloudTrail Processing Library for Java helps Java
developers to easily consume and process log files from AWS
CloudTrail.
Expand All @@ -26,7 +26,7 @@
</licenses>

<properties>
<aws-java-sdk.version>1.11.670</aws-java-sdk.version>
<aws-java-sdk.version>1.11.830</aws-java-sdk.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -397,6 +397,7 @@ private void buildS3Client() {
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setConnectionTimeout(SDK_TIME_OUT);
clientConfiguration.setSocketTimeout(SDK_TIME_OUT);
clientConfiguration.setMaxConnections(Math.max(clientConfiguration.DEFAULT_MAX_CONNECTIONS, config.getThreadCount()));

if (s3Client == null) {
s3Client = AmazonS3ClientBuilder.standard()
Expand All @@ -408,8 +409,11 @@ private void buildS3Client() {
}
private void buildSqsClient() {
if (sqsClient == null) {
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setMaxConnections(Math.max(clientConfiguration.DEFAULT_MAX_CONNECTIONS, config.getThreadCount()));
sqsClient = AmazonSQSClientBuilder.standard()
.withCredentials(config.getAwsCredentialsProvider())
.withClientConfiguration(clientConfiguration)
.withRegion(config.getSqsRegion())
.build();
}
Expand All @@ -431,7 +435,7 @@ private void buildReaderFactory() {

private void buildThreadPools() {
ThreadPoolFactory threadFactory = new ThreadPoolFactory(config.getThreadCount(), exceptionHandler);
scheduledThreadPool = threadFactory.createScheduledThreadPool();
scheduledThreadPool = threadFactory.createScheduledThreadPool(config.getNumOfParallelReaders());

if (mainThreadPool == null) {
mainThreadPool = threadFactory.createMainThreadPool();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -81,6 +81,11 @@ public class ClientConfiguration implements ProcessingConfiguration{
*/
public int threadCount = DEFAULT_THREAD_COUNT;

/**
* The number of SQS reader threads
*/
public int numOfParallelReaders = DEFAULT_NUM_OF_PARALLEL_READERS;

/**
* The time allowed, in seconds, for threads to shut down after {@link AWSCloudTrailProcessingExecutor#stop()} is
* called.
Expand Down Expand Up @@ -171,6 +176,14 @@ public int getThreadCount() {
return threadCount;
}

/**
* {@inheritDoc}
*/
@Override
public int getNumOfParallelReaders(){
return numOfParallelReaders;
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -277,6 +290,14 @@ public void setThreadCount(int threadCount) {
this.threadCount = threadCount;
}

/**
* The number of reader threads that pull messages from the SQS
* @param numOfParallelReaders
*/
public void setNumOfParallelReaders(int numOfParallelReaders){
this.numOfParallelReaders = numOfParallelReaders;
}

/**
* Set the time allowed, in seconds, for threads to shut down after
* {@link AWSCloudTrailProcessingExecutor#stop()} is called.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -53,6 +53,12 @@ public interface ProcessingConfiguration {
*/
public static final int DEFAULT_THREAD_COUNT = 1;


/**
* The default SQS reader thread count
*/
public static final int DEFAULT_NUM_OF_PARALLEL_READERS = 1;

/**
* The default thread termination delay, in seconds; {@value}.
*/
Expand Down Expand Up @@ -121,6 +127,12 @@ public interface ProcessingConfiguration {
*/
public int getThreadCount();

/**
* Get a number of reader threads
* @return
*/
public int getNumOfParallelReaders();

/**
* Get the thread termination delay value.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,6 +45,7 @@ public class PropertiesFileConfiguration implements ProcessingConfiguration{
public static final String VISIBILITY_TIMEOUT = "visibilityTimeout";
public static final String S3_REGION = "s3Region";
public static final String THREAD_COUNT = "threadCount";
public static final String NUM_OF_PARALLEL_READERS = "numOfParallelReaders";
public static final String THREAD_TERMINATION_DELAY_SECONDS = "threadTerminationDelaySeconds";
public static final String MAX_EVENTS_PER_EMIT = "maxEventsPerEmit";
public static final String ENABLE_RAW_EVENT_INFO = "enableRawEventInfo";
Expand Down Expand Up @@ -98,6 +99,12 @@ public class PropertiesFileConfiguration implements ProcessingConfiguration{
*/
private int threadCount = DEFAULT_THREAD_COUNT;


/**
* The number of threads used to get SQS messages
*/
private int numOfParallelReaders = DEFAULT_NUM_OF_PARALLEL_READERS;

/**
* The time allowed, in seconds, for threads to shut down after {@link AWSCloudTrailProcessingExecutor#stop()} is
* called.
Expand Down Expand Up @@ -147,6 +154,7 @@ public PropertiesFileConfiguration(String propertiesFile) {
sqsRegion = prop.getProperty(SQS_REGION);

threadCount = getIntProperty(prop, THREAD_COUNT);
numOfParallelReaders = getIntProperty(prop, NUM_OF_PARALLEL_READERS);
threadTerminationDelaySeconds = getIntProperty(prop, THREAD_TERMINATION_DELAY_SECONDS);

maxEventsPerEmit = getIntProperty(prop, MAX_EVENTS_PER_EMIT);
Expand Down Expand Up @@ -203,6 +211,13 @@ public int getThreadCount() {
return threadCount;
}

/**
* {@inheritDoc}
*/
public int getNumOfParallelReaders(){
return numOfParallelReaders;
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -246,7 +261,8 @@ public void validate() {
LibraryUtils.checkArgumentNotNull(getS3Region(), "S3 Region is null.");

LibraryUtils.checkCondition(getMaxEventsPerEmit() <= 0, "Maximum Events Per Emit is a non-positive integer.");
LibraryUtils.checkCondition(getThreadCount() <= 0, "Thread Count is a non-positive integer.");
LibraryUtils.checkCondition(getThreadCount() <= 0, "Num of Parallel Readers Count is a non-positive integer.");
LibraryUtils.checkCondition(getNumOfParallelReaders() <= 0, "Thread Count is a non-positive integer.");
LibraryUtils.checkCondition(getThreadTerminationDelaySeconds() <= 0, "Thread Termination Delay Seconds is a non-positive integer.");
LibraryUtils.checkCondition(getVisibilityTimeout() <= 0, "Visibility Timeout is a non-positive integer.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand All @@ -16,4 +16,4 @@
/**
* Exceptions that used in AWS CloudTrail Processing Library
*/
package com.amazonaws.services.cloudtrail.processinglibrary.exceptions;
package com.amazonaws.services.cloudtrail.processinglibrary.exceptions;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -64,8 +64,8 @@ public ThreadPoolFactory(int threadCount, ExceptionHandler exceptionHandler) {
*
* @return ScheduledExecutorService continuous poll messages from SQS queue.
*/
public ScheduledExecutorService createScheduledThreadPool() {
return Executors.newScheduledThreadPool(1);
public ScheduledExecutorService createScheduledThreadPool(int numOfParallelReaders) {
return Executors.newScheduledThreadPool(numOfParallelReaders);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand All @@ -16,4 +16,4 @@
/**
* Factories used to construct objects.
*/
package com.amazonaws.services.cloudtrail.processinglibrary.factory;
package com.amazonaws.services.cloudtrail.processinglibrary.factory;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand All @@ -16,4 +16,4 @@
/**
* Default implementation of call back interfaces.
*/
package com.amazonaws.services.cloudtrail.processinglibrary.impl;
package com.amazonaws.services.cloudtrail.processinglibrary.impl;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 98e22a7

Please sign in to comment.