General Purpose Transforms to write events as a batch request to the LOGIQ Stack
-
- Import the library to your project.
- Apply a function to transform your Events to LogiqEvent(s)
- Use the LogiqIO.Write class as a transform to start exporting events to a LOGIQ Stack endpoint.
package logiqio
import org.apache.beam.sdk.Pipeline
import org.apache.beam.sdk.transforms.Create
import kotlin.test.Test
class LogiqTest {
@Test fun validateResponse() {
val pipeline = Pipeline.create()
// Create a sample list of type LogiqEvent
val ele = List(50) {
LogiqEvent(
namespace = "ns$it",
message = "$it Events occurred",
timestamp = it,
host = "host-$it",
pid = "process-$it",
appName = "app-$it",
clusterId = "cos$it",
)
}
pipeline
.apply("Create elements", Create.of(ele)) // Use the LogiqEvent lists and add it to the pipeline
.apply(LogiqIO.Write(endpoint = "endpoint_here", ingestToken = "ingest_token_here")) // Use LogiqIO.Write with the logiq stack endpoints and ingestToken
pipeline.run().waitUntilFinish()
}
}
In order to export metrics to a Prometheus PushGateway, you can refer to this test