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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...