https://github.com/actigence/api-access-tracker-java-client
A simple Java client for API Access Tracker
https://github.com/actigence/api-access-tracker-java-client
apilogging apitracker java requestlogging
Last synced: 5 months ago
JSON representation
A simple Java client for API Access Tracker
- Host: GitHub
- URL: https://github.com/actigence/api-access-tracker-java-client
- Owner: actigence
- License: mit
- Created: 2020-04-30T04:58:30.000Z (about 6 years ago)
- Default Branch: develop
- Last Pushed: 2022-05-20T21:35:42.000Z (about 4 years ago)
- Last Synced: 2025-07-09T03:17:55.862Z (11 months ago)
- Topics: apilogging, apitracker, java, requestlogging
- Language: Java
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# API Access Tracker (Java Client)

This is the supporting Java client for [API Access Tracker](https://github.com/Actigence/api-access-tracker-backend).
This Java client in conjunction with the [API Access Tracker (Backend)](https://github.com/Actigence/api-access-tracker-backend)
can be used to log all request and response data for your webservices APIs. If you want to log all the requests coming to your
webservices you can use [API Access Tracker](https://github.com/Actigence/api-access-tracker-backend).
[API Access Tracker](https://github.com/Actigence/api-access-tracker-backend) stores all the request details of API calls
made to your webservices to AWS using serverless technologies such as AWS DynamoDB, AWS Lambda, AWS SQS etc.
This README will not detail into how [API Access Tracker](https://github.com/Actigence/api-access-tracker-backend) works,
but will describe setup of this Java client too allow you to start pushing data too AWS Stack created by
[API Access Tracker (Backend)](https://github.com/Actigence/api-access-tracker-backend).
# How this client works?
This client contains a simple Http Servlet filter, which when setup correctly, intercepts all the requests coming to your
APIs, and publishes them to the AWS SQS created by [API Access Tracker (Backend)](https://github.com/Actigence/api-access-tracker-backend).
Before starting to use this client, you must follow steps described in [API Access Tracker (Backend)](https://github.com/Actigence/api-access-tracker-backend)
to setup your AWS Stack.
# Getting Started
Follow below steps to setup **API Access Tracker**.
* Setup [API Access Tracker (Backend)](https://github.com/Actigence/api-access-tracker-backend)
* Create an AWS IAM user that has access to AWS SQS queues generated by **API Access Tracker (Backend)**.
You can use below policy for reference.
```$xslt
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"sqs:GetQueueUrl",
"sqs:SendMessage",
"sqs:CreateQueue"
],
"Resource": "arn:aws:sqs:us-east-1::aal_*"
}
]
}
```
* Add this **API Access Tracker (Java Client)** to you Java project.
For **Maven** Project
```$xslt
com.actigence
api-access-tracker-java-client
0.0.1
```
For **Gradle** Project
```$xslt
plugins {
id 'maven'
}
dependencies {
implementation 'com.actigence:api-access-tracker-java-client:0.0.1'
}
```
* Configure request filter to intercept desired URLs.
For projects build using Spring Boot add below configuration file:
```java
@Configuration
public class FilterConfiguration
{
@Bean
public FilterRegistrationBean loggingFilter()
{
FilterRegistrationBean registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(new ApiAccessLoggingFilter());
registrationBean.addUrlPatterns("/test/*");
registrationBean.addInitParameter("clientId", "MyServiceName");
return registrationBean;
}
}
```
For projects built using Java Servlets:
```xml
API Access Tracking Filter
com.actigence.aal.ApiAccessLoggingFilter
clientId
MyServiceName
API Access Tracking Filter
/test/*
```
That's it. Now any request made to your webservice APIs at the configured URLs will be intercepted and you will be able to see entries in AWS DynamoDB tables.
# Limitations
* Minimum Java version 8 is required.
* AWS SQS has limit of maximum payload size of 256 KB. Hence combined data of request and response values can not be more than 256 KB.