VMware vRealize LogInsight provides a REST API. For more information on REST API, refer to Steve Flanders blog post Log Insight 3.3: Query API
We are providing an easy to use java wrapper to interact with VMware vRealize LogInsight. This loginsight-java-api currently supports
- message queries
- aggregate queries and
- ingesion
Join us @gitter to discuss on any issues on using this API.
Functionality of this package is contained in Java package com.vmware.loginsightapi. To use the package, you need to use following Maven dependency:
<dependency>
<groupId>com.vmware.loginsightapi</groupId>
<artifactId>loginsight-java-api</artifactId>
<version>0.1.1</version>
</dependency>
In case of gradle project please use the following
compile group: 'com.vmware.loginsightapi', name: 'loginsight-java-api', version: '0.1.1'
####1. Connecting to LogInsight
LogInsightClient client = new LogInsightClient("host-name", "username", "password");
####2. Ingestion of messages to LogInsight
IngestionRequest request = new IngestionRequestBuilder()
.message(new Message("message line 1"))
.message(new MessageBuilder("message line 2")
.field("field1", "content 1").build())
.build();
CompletableFuture<IngestionResponse> responseFuture = client.ingest(request);
####3. Event Queries
MessageQuery mqb = (MessageQuery) new MessageQuery()
.addConstraint("field_1", FieldConstraint.Operator.EQ, "value1")
.addContentPackField("test");
CompletableFuture<MessageQueryResponse> responseFuture = client.messageQuery(mqb.toUrlString());
####4. Aggregation Queries
Default aggregation function is COUNT as defined by LogInsight API.
AggregateQuery aqb = (AggregateQuery) new AggregateQuery()
.addConstraint("field_1", FieldConstraint.Operator.EQ,"value1")
.addContentPackField("test");
CompletableFuture<AggregateQueryResponse> responseFuture = client.aggregateQuery(aqb.toUrlString());
- Java 8 JDK installed and set your JAVA_HOME to home of Java8 JDK
- vRealize LogInsight 3.3 onwards
$ ./gradlew clean build
The loginsight-java-api project team welcomes contributions from the community. If you wish to contribute code and you have not signed our contributor license agreement (CLA), our bot will update the issue when you open a Pull Request. For any questions about the CLA process, please refer to our FAQ. For more detailed information, refer to CONTRIBUTING.md.
Copyright © 2016 VMware, Inc. 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. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Some files may be comprised of various open source software components, each of which has its own license that is located in the source code of the respective component.