[
https://issues.apache.org/jira/browse/BEAM-8596?focusedWorklogId=443330&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-443330
]
ASF GitHub Bot logged work on BEAM-8596:
----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Jun/20 18:41
Start Date: 09/Jun/20 18:41
Worklog Time Spent: 10m
Work Description: sabhyankar commented on a change in pull request #11950:
URL: https://github.com/apache/beam/pull/11950#discussion_r437640982
##########
File path:
sdks/java/io/splunk/src/main/java/org/apache/beam/sdk/io/splunk/SplunkIO.java
##########
@@ -0,0 +1,359 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.splunk;
+
+import static
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument;
+import static
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.auto.value.AutoValue;
+import java.util.concurrent.ThreadLocalRandom;
+import javax.annotation.Nullable;
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.annotations.Experimental.Kind;
+import org.apache.beam.sdk.coders.BigEndianIntegerCoder;
+import org.apache.beam.sdk.coders.KvCoder;
+import org.apache.beam.sdk.options.ValueProvider;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.PTransform;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.values.KV;
+import org.apache.beam.sdk.values.PCollection;
+import
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.MoreObjects;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An unbounded sink for Splunk's Http Event Collector (HEC).
+ *
+ * <p>For more information, see the online documentation at <a
+ *
href="https://dev.splunk.com/enterprise/docs/dataapps/httpeventcollector/">Splunk
HEC</a>.
+ *
+ * <h3>Writing to Splunk's HEC</h3>
+ *
+ * <p>The {@link SplunkIO} class provides a {@link PTransform} that allows
writing {@link
+ * SplunkEvent} messages into a Splunk HEC end point.
+ *
+ * <p>It takes as an input a {@link PCollection
PCollection<SplunkEvent>}, where each {@link
+ * SplunkEvent} represents an event to be published to HEC.
+ *
+ * <p>To configure a {@link SplunkIO}, you must provide at a minimum:
+ *
+ * <ul>
+ * <li>url - HEC endpoint URL.
+ * <li>token - HEC endpoint token.
+ * </ul>
+ *
+ * <p>The {@link SplunkIO} transform can be customized further by optionally
specifying:
+ *
+ * <ul>
+ * <li>parallelism - Number of parallel requests to the HEC.
+ * <li>batchCount - Number of events in a single batch.
+ * <li>disableCertificateValidation - Whether to disable ssl validation
(useful for self-signed
+ * certificates)
+ * </ul>
+ *
+ * <p>This transform will return any non-transient write failures via a {@link
PCollection
+ * PCollection<SplunkWriteError>}, where each {@link SplunkWriteError}
captures the error that
+ * occurred while attempting to write to HEC. These can be published to a
dead-letter sink or
+ * reprocessed.
+ *
+ * <p>For example:
+ *
+ * <pre>{@code
+ * PCollection<SplunkEvent> events = ...;
+ *
+ * PCollection<SplunkWriteError> errors =
+ * events.apply("WriteToSplunk",
+ * SplunkIO.writeBuilder()
Review comment:
Thanks for that input! Switched to a fluent factory pattern for the
SplunkIO transform.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 443330)
Time Spent: 1h (was: 50m)
> Add SplunkIO transform to write messages to Splunk
> --------------------------------------------------
>
> Key: BEAM-8596
> URL: https://issues.apache.org/jira/browse/BEAM-8596
> Project: Beam
> Issue Type: New Feature
> Components: io-ideas
> Reporter: Sameer Abhyankar
> Assignee: Sameer Abhyankar
> Priority: P2
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Add a SplunkIO transform to write messages to Splunk's HTTP Event Collector
> end point. We already have an implementation [1] that works well and we are
> looking to contribute this to Beam.
>
> [1]
> [https://github.com/GoogleCloudPlatform/DataflowTemplates/tree/master/src/main/java/com/google/cloud/teleport/splunk]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)