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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...