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!

.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 ...