Getting Data In

How can I push a comma separated line of fields to Splunk using the Java SDK?

rbkaspr
New Member

I have a Java program that reads in a CSV and prints off lines where one field has a certain value, and want to set it up so that the lines are instead sent to a Splunk Light server sitting on localhost. I've managed to manually send data using curl and am looking for a simple example to replicate that functionality using the Java Splunk SDK.

My curl script (fields obfuscated):

curl -k -u admin "localhost:8089/services/receivers/simple?source=www&sourcetype=csv" -d "field1,field2,field3,field4,field5,field6,field7"

Again, is there any way for me to replicate the same functionality of the above curl script in Java? All the tutorials I'm finding have to do with remotely executing searches and contain no useful information about pushing data to the server.

Tags (4)
0 Karma

woodcock
Esteemed Legend
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...