Splunk Dev

Sending data stream to POST receivers/stream endpoint

misteryuku
Communicator

If i want to send the raw event text to the POST receivers/stream endpoint, the raw data is streamed in as OutputStream data type in Java?

0 Karma

Damien_Dallimor
Ultra Champion

Here is a very simple pseudo-code example showing the Object Types :

Service service = Service.connect(...);
Index index = service.getIndexes().get("someindex");
Socket socket = index.attach();
OutputStream ostream = socket.getOutputStream();
Writer writerOut = new OutputStreamWriter(ostream, "UTF8");

//stream 10 events to Splunk
for (int i=0; i<10; i++) {
  writerOut.write("Some data I want to stream to Splunk");
}

writerOut.flush();
writerOut.close();
socket.close();

Damien_Dallimor
Ultra Champion

If your original question was answered it would be good if you could start "accepting" answers.
It helps out splunkbase.

misteryuku
Communicator

May i know which Logback appender should i use if i want to create new events using the Splunk's REST receivers endpoint if i'm using logback framework. because i went to make a custom basic appender for that? Is it socket appender?

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...