You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "saloni-eng (via GitHub)" <gi...@apache.org> on 2026/09/12 19:18:37 UTC
[PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
saloni-eng opened a new pull request, #12281:
URL: https://github.com/apache/seatunnel/pull/12281
### Purpose of this pull request
This pull request introduces a new Apache SeaTunnel source connector: `connector-http-splunk`. It enables batch reading data from the Splunk REST API via an HTTP source pattern, utilizing token-based authentication and the synchronous export endpoint (`/services/search/jobs/export`).
### Does this PR introduce _any_ user-facing change?
Yes. It adds the new `Http-Splunk` source connector, including:
* The new `connector-http-splunk` module.
* Documentation (`docs/en/connector-v2/source/Http-Splunk.md`).
* Integration updates in `plugin-mapping.properties`, `plugin_config`, and `seatunnel-dist/pom.xml`.
### How was this patch tested?
* Added unit tests (`SplunkSourceFactoryTest.java`) to validate factory identification and proper `Authorization` header configuration.
* Verified structural and architectural consistency against existing HTTP connectors like Linear.
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License Notice according to the [New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the incompatibility caused by this PR.
* [x] If you are contributing the connector code, please check that the following files are updated:
1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "saloni-eng (via GitHub)" <gi...@apache.org>.
saloni-eng commented on PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#issuecomment-5659446914
Hey!
I had realised the inaccurate doc-path claim last time, but no worries at all :)
I edited the PR description to remove the Chinese translation bit that I had added earlier.
Thank you for the detailed reviews, glad we can merge it finally!
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "saloni-eng (via GitHub)" <gi...@apache.org>.
saloni-eng commented on PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#issuecomment-5687242966
Hi @DanielLeens ,
I’ve addressed all the review feedback from the fifth round. Here is a summary of the fixes implemented:
Issue 3 (Blocker — Test): Added a real behavioral test (testFailsFastWhenResponseExceedsMaxSize) using MockWebServer to verify the fail-fast exception path and ensure HttpConnectorException is correctly thrown when response sizes exceed limits.
Issue 2 (Blocker — Default & Documentation): Adjusted the default threshold for max_response_size_bytes to 20MB (20971520 bytes) and added a dedicated Large Exports & Memory Considerations section in the documentation detailing the heap sizing requirements.
Issue 4 (Non-blocking — Naming): Ensured the documentation file is properly aligned with connector conventions (Splunk.md).
As previously agreed, the broader streaming HttpClientProvider optimisation that we identified with @goutamadwant, and connector-family E2E tests are left out of scope for this PR, but remain worth tracking as future follow-ups!
Please have a look whenever you have a spare moment.
Thank you!
Saloni
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "saloni-eng (via GitHub)" <gi...@apache.org>.
saloni-eng commented on PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#issuecomment-5683077720
Hi @DanielLeens
I've pushed these updates to address your feedback:
1) Added the max_response_size_bytes configuration option to mitigate large-export OOM risks.
2) Added warning logs when responses approach the threshold.
3) Updated the English documentation to include the new option and a "Large Exports" advisory section.
4) Verified that all local tests and CI pipelines are passing cleanly.
This is ready for another look whenever you have a moment. Thank you!
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on code in PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#discussion_r4003906471
##########
seatunnel-connectors-v2/connector-http/connector-http-splunk/src/main/java/org/apache/seatunnel/connectors/seatunnel/splunk/SplunkSourceFactory.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.splunk;
+
+import org.apache.seatunnel.api.configuration.util.OptionRule;
+import org.apache.seatunnel.api.source.SeaTunnelSource;
+import org.apache.seatunnel.api.source.SourceSplit;
+import org.apache.seatunnel.api.table.connector.TableSource;
+import org.apache.seatunnel.api.table.factory.Factory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
+import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSourceFactory;
+import org.apache.seatunnel.connectors.seatunnel.splunk.config.SplunkSourceOptions;
+
+import com.google.auto.service.AutoService;
+
+import java.io.Serializable;
+
+@AutoService(Factory.class)
+public class SplunkSourceFactory extends HttpSourceFactory {
+ @Override
+ public String factoryIdentifier() {
+ return "Splunk";
+ }
+
+ @Override
+ public <T, SplitT extends SourceSplit, StateT extends Serializable>
+ TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext context) {
+ return () -> (SeaTunnelSource<T, SplitT, StateT>) new SplunkSource(context.getOptions());
+ }
+
+ @Override
+ public OptionRule optionRule() {
+ return getHttpBuilder().required(SplunkSourceOptions.API_KEY).build();
Review Comment:
Confirmed against the current head (`90d798ad`). `SplunkSourceFactory.optionRule()` (`SplunkSourceFactory.java:47-49`) only adds `.required(SplunkSourceOptions.API_KEY)` on top of `getHttpBuilder()`, and `getHttpBuilder()` (`HttpSourceFactory.java:54-75`) does not list `KEEP_PARAMS_AS_FORM` either. `SplunkSourceParameter.buildWithConfig()` reads it directly off `pluginConfig.get(SplunkSourceOptions.KEEP_PARAMS_AS_FORM)` (`SplunkSourceParameter.java:49`), and the doc's own example config sets it explicitly. On the real source-parsing path, `ConfigValidationUtils` calls `ConfigValidator.validateUnknownKeys(...)` against `sourceFactory.optionRule()` before the source is even constructed (`ConfigValidationUtils.java:247-250`), so this key is rejected as unrecognized for any job that follows the documented example.
Good catch — my last review verified functional behavior end-to-end but didn't drive the documented config through actual config validation. Treating this as a real, current blocker: `optionRule()` needs `.optional(SplunkSourceOptions.KEEP_PARAMS_AS_FORM)`.
##########
docs/en/connectors/source/Http-Splunk.md:
##########
@@ -0,0 +1,43 @@
+import ChangeLog from '../changelog/connector-http-splunk.md';
+
+# Http-Splunk Source Connector
+
+## Description
+
+The `Http-Splunk` connector allows batch reading data from Splunk REST API endpoints using an HTTP source pattern. It utilizes token-based authentication and supports synchronous search export endpoints via POST requests.
+
+## Key Features
+
+* HTTP-based ingestion from Splunk REST API (`/services/search/v2/jobs/export`)
+* Token-based authentication via the `Authorization` header
+* Form-urlencoded parameter mapping for search queries and output formats
+
+## Options
+
+| Name | Type | Required | Default | Description |
+| --- | --- | --- | --- | --- |
+| url | String | Yes | - | Splunk REST API search export URL (`/services/search/v2/jobs/export`) |
+| api_key | String | Yes | - | Splunk authentication token (e.g., `Splunk <token>`) |
+| method | String | No | `POST` | HTTP request method |
+| keep_params_as_form | Boolean | No | `true` | Keep parameters as form urlencoded |
+| params | Map | Yes | - | Request parameters including `search` and `output_mode` |
+
+## Example Configuration
+
+```hocon
+source {
+ Http-Splunk {
Review Comment:
Confirmed. `SplunkSourceFactory.factoryIdentifier()` returns `"Splunk"` (`SplunkSourceFactory.java:36-38`), and `plugin-mapping.properties:198` registers `seatunnel.source.Splunk = connector-http-splunk` — there is no `Http-Splunk` factory registered anywhere in the tree. The example block at `docs/en/connectors/source/Http-Splunk.md:29` (`Http-Splunk {`) will fail factory discovery exactly as you describe; it needs to be `Splunk {` to match the registered identifier.
I verified the registration chain in my last review (factory/plugin-mapping/plugin_config/dist dependency) but never actually parsed the doc's own example config against it. Thanks for catching this — agreed it's a real blocker, the shipped example currently can't run.
##########
seatunnel-connectors-v2/connector-http/connector-http-splunk/src/main/java/org/apache/seatunnel/connectors/seatunnel/splunk/config/SplunkSourceParameter.java:
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.splunk.config;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.connectors.seatunnel.http.config.HttpParameter;
+
+import java.util.HashMap;
+
+public class SplunkSourceParameter extends HttpParameter {
+ /**
+ * Overrides buildWithConfig to accept an explicit apiKey parameter. Splunk's REST API requires
+ * the API key to be passed specifically as an Authorization header, so this method ensures the
+ * key is properly extracted and configured.
+ */
+ public void buildWithConfig(ReadonlyConfig pluginConfig, String apiKey) {
+ super.buildWithConfig(pluginConfig);
Review Comment:
Confirmed. `HttpSourceOptions.METHOD` defaults to `GET` (`HttpSourceOptions.java:99-103`), and `SplunkSourceParameter.buildWithConfig()` never overrides it — it only sets headers/params/`keepParamsAsForm`/`enableMultilines` (`SplunkSourceParameter.java:31-52`), so an omitted `method` really does resolve to `GET` at runtime. That contradicts the doc's own options table (`method | ... | Default: POST`), and the shipped example only avoids the bug because it sets `method = "POST"` explicitly, masking it.
Agreed this is a real functional gap for any user who leaves `method` unset. I'd lean toward the connector hard-defaulting to POST for this endpoint (or validating and rejecting GET) rather than relying on every user to set it explicitly. Good find.
##########
seatunnel-connectors-v2/connector-http/connector-http-splunk/src/main/java/org/apache/seatunnel/connectors/seatunnel/splunk/SplunkSource.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.splunk;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitReader;
+import org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext;
+import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSource;
+import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSourceReader;
+import org.apache.seatunnel.connectors.seatunnel.splunk.config.SplunkSourceOptions;
+import org.apache.seatunnel.connectors.seatunnel.splunk.config.SplunkSourceParameter;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class SplunkSource extends HttpSource {
+ private final SplunkSourceParameter splunkSourceParameter = new SplunkSourceParameter();
+
+ public SplunkSource(ReadonlyConfig pluginConfig) {
+ super(pluginConfig);
+ String apiKey = pluginConfig.get(SplunkSourceOptions.API_KEY);
+ splunkSourceParameter.buildWithConfig(pluginConfig, apiKey);
+ }
+
+ @Override
+ public String getPluginName() {
+ return "splunk";
+ }
+
+ @Override
+ public AbstractSingleSplitReader<SeaTunnelRow> createReader(
+ SingleSplitReaderContext readerContext) throws Exception {
+ return new HttpSourceReader(
Review Comment:
Confirmed against the current head — I had this flagged as unresolved from my first review but hadn't reproduced OOM myself, so thank you for the concrete repro. Traced the full buffering chain: `HttpClientProvider.execute()` materializes the entire response body as a `String` via `EntityUtils.toString(...)` (`HttpClientProvider.java:632`), then `SplunkSourceReader.executeRequest()` (`SplunkSourceReader.java:52-56`) hands that whole string to `filterAndUnwrapNdjson()`, which builds a second full copy via `StringBuilder` (`SplunkSourceReader.java:63-87`) before the parent's `pollAndCollectData()` (`HttpSourceReader.java:165-178`) does a third pass over it with `BufferedReader`/line splitting. There's no streaming boundary anywhere in that chain, so peak memory is a multiple of the raw response size — consistent with your 30MB-response/96MB-heap repro.
This needs to become a single streaming pass (read the response body line-by-line and unwrap/emit per line, or use Splunk's paginated job/results flow) instead of three sequential full-body copies. Treating this as a High-severity blocker, not resolved by the current head — it's the same class of unbounded-materialization risk we just fixed for engine log responses in #12299, for what it's worth.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "saloni-eng (via GitHub)" <gi...@apache.org>.
saloni-eng commented on PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#issuecomment-5663807721
@goutamadwant @DanielLeens
I think I confirmed the root cause for the OOM risk, HttpClientProvider.getResponse() calls EntityUtils.toString(), which buffers the entire entity before my code ever sees it, so my line-splitting in SplunkSourceReader doesn't help. A real fix means avoiding that full buffering, which requires either:
a) Adding a new streaming method to HttpClientProvider (e.g. executeLineStreaming, mirroring the existing executeBinaryStreaming pattern) and having SplunkSourceReader override pollAndCollectData() to use it directly.
b) Some other approach you'd prefer, if there's already a mechanism for this I'm missing.
Option 1 means touching connector-http-base, which is shared across every HTTP connector — is that in scope for this PR, or would you rather I split it into a separate PR against connector-http-base that this one then depends on? Also want to confirm: is there a specific max response size / heap ratio you'd want this to hold up to?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "saloni-eng (via GitHub)" <gi...@apache.org>.
saloni-eng commented on PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#issuecomment-5653711040
@DanielLeens Just a quick note on the Chinese documentation (docs/zh/connectors/source/Http-Splunk.md): I've intentionally left that out of this scope to keep this PR focused and moving forward. Feel free to leave it as a separate follow-up task or pick it up in a separate PR for anyone looking to contribute!
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#issuecomment-5661991396
@saloni-eng thank you for the kind words — really appreciate you sticking with this through three rounds!
I do need to walk back my "Ready to merge" conclusion from earlier today, though. @goutamadwant just posted four more findings against the same current head (`90d798ad`), and I've verified each of them independently in-thread — all four are real, current issues, not something already resolved by a prior commit:
1. `keep_params_as_form` is documented and consumed by `SplunkSourceParameter`, but missing from `SplunkSourceFactory.optionRule()` — real jobs using the documented config fail config validation with "unknown option keys".
2. The doc's example block name (`Http-Splunk {`) doesn't match the registered factory identifier (`Splunk`), so the documented example config can't be parsed as written.
3. The documented default `method: POST` doesn't match the actual code default (`GET`, inherited from `HttpSourceOptions.METHOD`) — an omitted `method` silently breaks against Splunk's export endpoint.
4. `SplunkSourceReader.filterAndUnwrapNdjson()` still fully materializes the response multiple times over rather than streaming it — a real OOM risk on large exports, reproduced by @goutamadwant with a 30MB response under a 96MB heap.
No new commit has landed since my last review, so I'm not doing a fresh full review pass right now — but please treat my earlier "Ready to merge" as superseded. This PR currently has 4 open blockers (config-validation gap, doc/factory-identifier mismatch, wrong default, memory/OOM) that need fixing first. Once a fix is pushed, ping me and I'll do a full re-review of the new head.
Thanks both for the very thorough back-and-forth on this one — this kind of scrutiny is exactly what keeps a new connector production-safe before it ships.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#issuecomment-5648299763
The PR description currently says it addresses #10443. Splunk Source is tracked and claimed under #10753, so please update the reference to #10753.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on code in PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#discussion_r4002922472
##########
seatunnel-connectors-v2/connector-http/connector-http-splunk/src/main/java/org/apache/seatunnel/connectors/seatunnel/splunk/config/SplunkSourceParameter.java:
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.splunk.config;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.connectors.seatunnel.http.config.HttpParameter;
+
+import java.util.HashMap;
+
+public class SplunkSourceParameter extends HttpParameter {
+ /**
+ * Overrides buildWithConfig to accept an explicit apiKey parameter. Splunk's REST API requires
+ * the API key to be passed specifically as an Authorization header, so this method ensures the
+ * key is properly extracted and configured.
+ */
+ public void buildWithConfig(ReadonlyConfig pluginConfig, String apiKey) {
+ super.buildWithConfig(pluginConfig);
Review Comment:
Please give this connector a real POST default after loading the shared HTTP options. `HttpSourceOptions.METHOD` defaults to GET, so omitting the optional `method`—whose documented default is POST—leaves `parameter.getMethod()` as `get`. Splunk's `/services/search/v2/jobs/export` endpoint does not provide GET, so that otherwise valid configuration fails. Please set or validate POST and add a request-capture test with `method` omitted.
##########
docs/en/connectors/source/Http-Splunk.md:
##########
@@ -0,0 +1,43 @@
+import ChangeLog from '../changelog/connector-http-splunk.md';
+
+# Http-Splunk Source Connector
+
+## Description
+
+The `Http-Splunk` connector allows batch reading data from Splunk REST API endpoints using an HTTP source pattern. It utilizes token-based authentication and supports synchronous search export endpoints via POST requests.
+
+## Key Features
+
+* HTTP-based ingestion from Splunk REST API (`/services/search/v2/jobs/export`)
+* Token-based authentication via the `Authorization` header
+* Form-urlencoded parameter mapping for search queries and output formats
+
+## Options
+
+| Name | Type | Required | Default | Description |
+| --- | --- | --- | --- | --- |
+| url | String | Yes | - | Splunk REST API search export URL (`/services/search/v2/jobs/export`) |
+| api_key | String | Yes | - | Splunk authentication token (e.g., `Splunk <token>`) |
+| method | String | No | `POST` | HTTP request method |
+| keep_params_as_form | Boolean | No | `true` | Keep parameters as form urlencoded |
+| params | Map | Yes | - | Request parameters including `search` and `output_mode` |
+
+## Example Configuration
+
+```hocon
+source {
+ Http-Splunk {
Review Comment:
Please use `Splunk {` here. SeaTunnel copies this block name verbatim into `plugin_name`; the factory and plugin mapping are both registered as `Splunk`, not `Http-Splunk`. I parsed this example through the current config parser and factory discovery failed with “Could not find any factory for identifier 'Http-Splunk'” (available identifiers: `Http`, `Splunk`), so the documented job cannot start.
##########
seatunnel-connectors-v2/connector-http/connector-http-splunk/src/main/java/org/apache/seatunnel/connectors/seatunnel/splunk/SplunkSourceFactory.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.splunk;
+
+import org.apache.seatunnel.api.configuration.util.OptionRule;
+import org.apache.seatunnel.api.source.SeaTunnelSource;
+import org.apache.seatunnel.api.source.SourceSplit;
+import org.apache.seatunnel.api.table.connector.TableSource;
+import org.apache.seatunnel.api.table.factory.Factory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
+import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSourceFactory;
+import org.apache.seatunnel.connectors.seatunnel.splunk.config.SplunkSourceOptions;
+
+import com.google.auto.service.AutoService;
+
+import java.io.Serializable;
+
+@AutoService(Factory.class)
+public class SplunkSourceFactory extends HttpSourceFactory {
+ @Override
+ public String factoryIdentifier() {
+ return "Splunk";
+ }
+
+ @Override
+ public <T, SplitT extends SourceSplit, StateT extends Serializable>
+ TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext context) {
+ return () -> (SeaTunnelSource<T, SplitT, StateT>) new SplunkSource(context.getOptions());
+ }
+
+ @Override
+ public OptionRule optionRule() {
+ return getHttpBuilder().required(SplunkSourceOptions.API_KEY).build();
Review Comment:
Please declare `SplunkSourceOptions.KEEP_PARAMS_AS_FORM` as an optional factory option. It is documented and consumed by `SplunkSourceParameter`, but `getHttpBuilder()` does not include this key. I passed the documented configuration to `ConfigValidator.validateUnknownKeys`, used by SeaTunnel's config-validation paths, and it failed with `unknown option keys: [keep_params_as_form]`. Please add it to the option rule and cover the documented configuration with a validation test.
##########
seatunnel-connectors-v2/connector-http/connector-http-splunk/src/main/java/org/apache/seatunnel/connectors/seatunnel/splunk/SplunkSource.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.splunk;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitReader;
+import org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext;
+import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSource;
+import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSourceReader;
+import org.apache.seatunnel.connectors.seatunnel.splunk.config.SplunkSourceOptions;
+import org.apache.seatunnel.connectors.seatunnel.splunk.config.SplunkSourceParameter;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class SplunkSource extends HttpSource {
+ private final SplunkSourceParameter splunkSourceParameter = new SplunkSourceParameter();
+
+ public SplunkSource(ReadonlyConfig pluginConfig) {
+ super(pluginConfig);
+ String apiKey = pluginConfig.get(SplunkSourceOptions.API_KEY);
+ splunkSourceParameter.buildWithConfig(pluginConfig, apiKey);
+ }
+
+ @Override
+ public String getPluginName() {
+ return "splunk";
+ }
+
+ @Override
+ public AbstractSingleSplitReader<SeaTunnelRow> createReader(
+ SingleSplitReaderContext readerContext) throws Exception {
+ return new HttpSourceReader(
Review Comment:
The row splitting and preview filtering are fixed, but the incremental part of this thread is still unresolved. `super.executeRequest()` still buffers the complete export through `EntityUtils.toString()`, and `filterAndUnwrapNdjson()` then calls `split()` and builds a second full response string before the parent reads it line by line.
I reproduced this at the current head with a 30,000,148-byte valid Splunk NDJSON response under a 96 MiB heap: the raw response fit, but `filterAndUnwrapNdjson()` threw `OutOfMemoryError`. Please process the response entity line by line and emit or unwrap rows without materializing both the complete raw and filtered responses, or use the job/results pagination flow for bounded memory.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature] [connector-http] Add Splunk Source Connector and Unit Tests [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on code in PR #12281:
URL: https://github.com/apache/seatunnel/pull/12281#discussion_r3997361463
##########
seatunnel-connectors-v2/connector-http/connector-http-splunk/src/main/java/org/apache/seatunnel/connectors/seatunnel/splunk/config/SplunkSourceParameter.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.splunk.config;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.connectors.seatunnel.http.config.HttpParameter;
+
+import java.util.HashMap;
+
+public class SplunkSourceParameter extends HttpParameter {
+ /**
+ * Overrides buildWithConfig to accept an explicit apiKey parameter. Splunk's REST API requires
+ * the API key to be passed specifically as an Authorization header, so this method ensures the
+ * key is properly extracted and configured.
+ */
+ public void buildWithConfig(ReadonlyConfig pluginConfig, String apiKey) {
+ super.buildWithConfig(pluginConfig);
Review Comment:
The documented POST request is not encoded correctly. super.buildWithConfig() leaves the configured body as a plain string, and HttpClientProvider consequently sends search=...&output_mode=json with Content-Type: application/json. Splunk expects these values as URL-encoded form parameters. Please construct the request with POST/form semantics and model search and output_mode as form fields. A request-capture test should assert the method, content type, and decoded parameter values.
##########
docs/en/connector-v2/source/Http-Splunk.md:
##########
@@ -0,0 +1,34 @@
+# Http-Splunk
+
+> Http-Splunk source connector
+
+## Description
+
+Read data from the Splunk API via HTTP.
+
+## Key Features
+
+- [x] batch
+- [ ] stream
+- [ ] exactly-once
+
+## Options
+
+| Name | Type | Required | Default Value | Description |
+| --- | --- | --- | --- | --- |
+| url | String | Yes | - | Splunk REST API Endpoint URL |
+| api_key | String | Yes | - | Splunk Authorization Token or API Key |
+| plugin_output | String | No | - | The result table name when generating data |
+
+## Example
+
+```hocon
+source {
+ Http-Splunk {
+ url = "https://your-splunk-instance:8089/services/search/jobs/export"
Review Comment:
The /services/search/jobs/export endpoint is deprecated and disabled in current Splunk releases. Please update the example and tests to use /services/search/v2/jobs/export. This page should also be moved under docs/en/connectors/source/, which is the directory included in the connector sidebar, and a matching docs/zh/connectors/source/ page should be added.
##########
seatunnel-connectors-v2/connector-http/connector-http-splunk/src/main/java/org/apache/seatunnel/connectors/seatunnel/splunk/SplunkSource.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.splunk;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitReader;
+import org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext;
+import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSource;
+import org.apache.seatunnel.connectors.seatunnel.http.source.HttpSourceReader;
+import org.apache.seatunnel.connectors.seatunnel.splunk.config.SplunkSourceOptions;
+import org.apache.seatunnel.connectors.seatunnel.splunk.config.SplunkSourceParameter;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class SplunkSource extends HttpSource {
+ private final SplunkSourceParameter splunkSourceParameter = new SplunkSourceParameter();
+
+ public SplunkSource(ReadonlyConfig pluginConfig) {
+ super(pluginConfig);
+ String apiKey = pluginConfig.get(SplunkSourceOptions.API_KEY);
+ splunkSourceParameter.buildWithConfig(pluginConfig, apiKey);
+ }
+
+ @Override
+ public String getPluginName() {
+ return "splunk";
+ }
+
+ @Override
+ public AbstractSingleSplitReader<SeaTunnelRow> createReader(
+ SingleSplitReaderContext readerContext) throws Exception {
+ return new HttpSourceReader(
Review Comment:
HttpSourceReader does not preserve Splunk export semantics here. The underlying HTTP client buffers the complete response with EntityUtils.toString(), and with the default enable_multi_lines = false, the entire newline-delimited export is emitted as one content row. Splunk returns separate JSON objects for result rows and can include preview and final result sets. Please consume the response incrementally, emit individual result rows, and prevent preview/final duplicates. A regression containing two result lines should produce exactly two SeaTunnel rows.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org