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 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...