Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ The Inbound channel adapter is used to read data from Splunk and output a messag
Outbound channel adapter:
----------------------------------------------------------------------------------------------

The Outbound channel adapter is used to write data to Splunk from a Spring Integration message channel. There are 3 types of data writers provided:
The Outbound channel adapter is used to write data to Splunk from a Spring Integration message channel. There are 4 types of data writers provided:

* submit - Use's Splunk's REST API. Appropriate for small or infrequent data loads. Posts data to a named index or the default if not specified.
* index - Streams data to a named index or the default if not specified.
* tcp - Streams data to a tcp port associated with a defined tcp input.
* hec - Sends data to Splunk using the high performannce HTTP Event Collector

It is strongly recommended that you use the "hec" adaptor. The other 3 are legacy implementations.

The outbound channel adapter requires a child *-writer element which defines related attributes:

Expand Down Expand Up @@ -117,6 +120,20 @@ The outbound channel adapter requires a child *-writer element which defines rel
</int-splunk:outbound-channel-adapter>
```

### HEC (HTTP Event Collector)

```xml
<int-splunk:outbound-channel-adapter
id="splunkOutboundChannelAdapter"
channel="outputToSplunk"
splunk-server-ref="splunkServer"
>
<int-splunk:hec-writer host="somehost" port="8088" token="4DBFC24E-19A2-4D31-9055-2139C818DBDD" https="false"
poolsize="3" index="main" source="springintegration" sourcetype="test" batchMode="true"
maxBatchSizeBytes="1048576" maxBatchSizeEvents="50000" maxInactiveTimeBeforeBatchFlush="5000" />
</int-splunk:outbound-channel-adapter>
```

*NOTE: The input must exist and be enabled on the server*

### Configuring The Splunk Server connection
Expand Down Expand Up @@ -166,3 +183,4 @@ To generate Eclipse metadata (e.g., .classpath and .project files), do the follo

./gradlew eclipse


9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ dependencies {
compile "org.springframework.integration:spring-integration-core:$springIntegrationVersion"
compile "joda-time:joda-time:$jodaTimeVersion"
compile "commons-pool:commons-pool:$commonsPoolVersion"

compile "commons-codec:commons-codec:$commonsCodecVersion"
compile "commons-logging:commons-logging:$commonsLoggingVersion"
compile "org.apache.httpcomponents:httpasyncclient:$commonsHTTPAsyncClientVersion"
compile "org.apache.httpcomponents:httpasyncclient-cache:$commonsHTTPAsyncClientCacheVersion"
compile "org.apache.httpcomponents:httpclient:$commonsHTTPClientVersion"
compile "org.apache.httpcomponents:httpclient-cache:$commonsHTTPClientCacheVersion"
compile "org.apache.httpcomponents:httpcore:$commonsHTTPCoreVersion"
compile "org.apache.httpcomponents:httpcore-nio:$commonsHTTPCoreNIOVersion"
testCompile "org.mockito:mockito-all:$mockitoVersion"
testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion"
testCompile "junit:junit-dep:$junitVersion"
Expand Down
8 changes: 8 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ mockitoVersion=1.9.5
junitVersion=4.11
log4jVersion=1.2.17
jodaTimeVersion=2.3
commonsCodecVersion=1.9
commonsLoggingVersion=1.2
commonsHTTPAsyncClientVersion=4.1
commonsHTTPAsyncClientCacheVersion=4.1
commonsHTTPClientVersion=4.4.1
commonsHTTPClientCacheVersion=4.4.1
commonsHTTPCoreVersion=4.4.1
commonsHTTPCoreNIOVersion=4.4.1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.integration.splunk.outbound.SplunkOutboundChannelAdapter;
import org.springframework.integration.splunk.support.SplunkArgsFactoryBean;
import org.springframework.integration.splunk.support.SplunkHECWriter;
import org.springframework.integration.splunk.support.SplunkIndexWriter;
import org.springframework.integration.splunk.support.SplunkServiceFactory;
import org.springframework.integration.splunk.support.SplunkSubmitWriter;
Expand All @@ -42,6 +43,7 @@
* @author Jarred Li
* @author David Turanski
* @author Olivier Lamy
* @author Damien Dallimore
* @since 1.0
*
*/
Expand Down Expand Up @@ -130,6 +132,23 @@ private BeanDefinitionBuilder parseDataWriter(Element element) {
dataWriterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkTcpWriter.class);
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "port");

}
if (DomUtils.getChildElementByTagName(element, "hec-writer") != null) {
Element dataWriter = DomUtils.getChildElementByTagName(element, "hec-writer");
dataWriterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SplunkHECWriter.class);
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "host");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "port");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "token");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "https");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "poolsize");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "index");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "source");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "sourcetype");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "batchMode");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "maxBatchSizeBytes");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "maxBatchSizeEvents");
IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, dataWriter, "maxInactiveTimeBeforeBatchFlush");

}

IntegrationNamespaceUtils.setValueIfAttributeDefined(dataWriterBuilder, element,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading