Skip to main content

Audit | Java SDK

The audit API is designed for recording a trail of application-based user activity in a scalable, tamper-proof log.

Creates a new Secure Audit Log API client.

AuditClient(Builder builder)

Builder

void
 final var config = new Config.Builder(token, domain).build();
 final var client = new AuditClient.Builder(config).build();

Log an entry

log(IEvent event, LogConfig config)

Create a log entry in the Secure Audit Log.

IEvent

event to log

LogConfig

LogResponse

LogResponse

 StandardEvent event = new StandardEvent
 	.Builder("Hello, World!")
 	.action("Login")
 	.actor("Terminal")
 	.build();
 LogConfig config = new LogConfig.Builder().build();

 LogResponse response = client.log(event, config);

Log multiple entries

logBulk(cloud.pangeacyber.pangea.audit.models.IEvent[] events, LogConfig config)

Create multiple log entries in the Secure Audit Log.

cloud.pangeacyber.pangea.audit.models.IEvent[]

events to log

LogConfig

LogBulkResponse

LogBulkResponse

 StandardEvent event = new StandardEvent
 	.Builder("Hello, World!")
 	.action("Login")
 	.actor("Terminal")
 	.build();
 StandardEvent[] events = {event};
 LogConfig config = new LogConfig.Builder().build();

 LogBulkResponse response = client.logBulk(events, config);

Log multiple entries asynchronously

logBulkAsync(cloud.pangeacyber.pangea.audit.models.IEvent[] events, LogConfig config)

Asynchronously create multiple log entries in the Secure Audit Log.

cloud.pangeacyber.pangea.audit.models.IEvent[]

events to log

LogConfig

LogBulkResponse

LogBulkResponse

 StandardEvent event = new StandardEvent
 	.Builder("Hello, World!")
 	.action("Login")
 	.actor("Terminal")
 	.build();
 StandardEvent[] events = {event};
 LogConfig config = new LogConfig.Builder().build();

 LogBulkResponse response = client.logBulkAsync(events, config);

Get last root

getRoot()

Get last root from Pangea Server

RootResponse

RootResponse

 RootResponse response = client.getRoot();

Tamperproof verification

getRoot(int treeSize)

Returns current root hash and consistency proof.

int

tree size to get root

RootResponse

RootResponse

 RootResponse response = client.getRoot(treeSize);

Download search results

downloadResults(DownloadRequest request)

Get all search results as a compressed (gzip) CSV file.

DownloadRequest

Request parameters.

DownloadResponse

URL where search results can be downloaded.

 var response = client.downloadResults(
     new DownloadRequest.Builder("pas_[...]")
         .format(DownloadFormat.CSV)
         .build()
 );

Log streaming endpoint

logStream(BaseRequest request)

This API allows 3rd party vendors (like Auth0) to stream events to this endpoint where the structure of the payload varies across different vendors.

BaseRequest

Event data. The exact schema of this will vary by vendor.

Response

A Pangea response.

 // Extend `BaseRequest` and model what the streaming data looks like.
 public final class LogStreamRequest extends BaseRequest {
 	@JsonProperty("logs")
 	private List<LogStreamEvent> logs;
 }

 // Then later on, log it like so:
 final var input = new LogStreamRequest();
 final var response = await client.logStream(input);
search(SearchRequest request, SearchConfig config)

Perform a search of logs according to input param. By default verify logs consistency and events hash and signature.

SearchRequest
SearchConfig

SearchResponse

SearchResponse

 SearchRequest searchRequest = new SearchRequest
 	.Builder("message:\"\"").limit(10).build();
 SearchConfig searchConfig = new SearchConfig.Builder().build();

 SearchResponse response = client.search(searchRequest, searchConfig);
results(ResultRequest request, SearchConfig config)

Fetch paginated results of a previously executed search. By default: verifyEvents is true and verifyConsistency is false.

ResultRequest
SearchConfig

ResultsResponse

ResultsResponse

 ResultRequest request = new ResultRequest
 	.Builder("pas_sqilrhruwu54uggihqj3aie24wrctakr")
 	.limit(3)
 	.offset(0)
 	.build();
 SearchConfig searchConfig = new SearchConfig.Builder().build();

 ResultsResponse response = client.results(request, searchConfig);

Export from the audit log

export(ExportRequest request)

Bulk export of data from the Secure Audit Log, with optional filtering.

ExportRequest

Request parameters.

Response
 var response = client.export(ExportRequest.builder().verbose(true).build());