Getting Data In

Send Arguments in attachWith - host,sourcetype and time

akshgpt25
Explorer

Hi,

Q1. We are trying to push data using Splunk SDK for java and using attachWith() to ingest the data.

But how we can override host, sourcetype and time field using the same.

Q2. attach() takes Args argument with which we can override host and sourcetype but time is again not there. 

As mentioned in the documentation, our preference is also using attachWIth. Please suggest the right way to do the same.

myIndex.attachWith(new ReceiverBehavior() {
public void run(OutputStream stream) throws IOException {
Writer out = new OutputStreamWriter(stream, "UTF8");
for (int i = 0; i < 2; i++) {
out.write("This is my msg");
}
out.flush();
}
});

We are referring https://dev.splunk.com/enterprise/docs/java/sdk-java/howtousesdkjava/howtogetdatasdkjava 

Labels (7)
Tags (1)
0 Karma

royalhrk
Loves-to-Learn Lots

I am also facing the same problem with attachWith(), we are using Splunk Java SDK 1.6.X. any help updates on it.

Hassan

0 Karma
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...