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) 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.
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.
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.
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 response = client.getRoot();
Tamperproof verification
getRoot(int treeSize)Returns current root hash and consistency proof.
RootResponse response = client.getRoot(treeSize);
Download search results
downloadResults(DownloadRequest request)Get all search results as a compressed (gzip) CSV file.
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.
// 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
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 searchRequest = new SearchRequest
.Builder("message:\"\"").limit(10).build();
SearchConfig searchConfig = new SearchConfig.Builder().build();
SearchResponse response = client.search(searchRequest, searchConfig);
Results of a search
results(ResultRequest request, SearchConfig config)Fetch paginated results of a previously executed search. By default: verifyEvents
is true and verifyConsistency
is false.
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.
var response = client.export(ExportRequest.builder().verbose(true).build());