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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...