<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Send Arguments in attachWith - host,sourcetype and time in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Send-Arguments-in-attachWith-host-sourcetype-and-time/m-p/509489#M86665</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Q1. We are trying to push data using Splunk SDK for java and using attachWith() to ingest the data.&lt;/P&gt;&lt;P&gt;But how we can override host, sourcetype and time field using the same.&lt;/P&gt;&lt;P&gt;Q2. attach() takes Args argument with which we can override host and sourcetype but time is again not there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;As mentioned in the documentation, our preference is also using attachWIth. Please suggest the right way to do the same.&lt;/P&gt;&lt;PRE&gt;myIndex.attachWith(&lt;SPAN&gt;new &lt;/SPAN&gt;ReceiverBehavior() {&lt;BR /&gt;    &lt;SPAN&gt;public void &lt;/SPAN&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;(OutputStream stream) &lt;SPAN&gt;throws &lt;/SPAN&gt;IOException {&lt;BR /&gt;        Writer out = &lt;SPAN&gt;new &lt;/SPAN&gt;OutputStreamWriter(stream&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"UTF8"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        for &lt;/SPAN&gt;(&lt;SPAN&gt;int &lt;/SPAN&gt;i = &lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;i &amp;lt; &lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;i++) {&lt;BR /&gt;            out.write(&lt;SPAN&gt;"This is my msg"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;        }&lt;BR /&gt;        out.flush()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;})&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;We are referring&amp;nbsp;&lt;A href="https://dev.splunk.com/enterprise/docs/java/sdk-java/howtousesdkjava/howtogetdatasdkjava" target="_blank"&gt;https://dev.splunk.com/enterprise/docs/java/sdk-java/howtousesdkjava/howtogetdatasdkjava&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jul 2020 10:04:29 GMT</pubDate>
    <dc:creator>akshgpt25</dc:creator>
    <dc:date>2020-07-16T10:04:29Z</dc:date>
    <item>
      <title>Send Arguments in attachWith - host,sourcetype and time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Send-Arguments-in-attachWith-host-sourcetype-and-time/m-p/509489#M86665</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Q1. We are trying to push data using Splunk SDK for java and using attachWith() to ingest the data.&lt;/P&gt;&lt;P&gt;But how we can override host, sourcetype and time field using the same.&lt;/P&gt;&lt;P&gt;Q2. attach() takes Args argument with which we can override host and sourcetype but time is again not there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;As mentioned in the documentation, our preference is also using attachWIth. Please suggest the right way to do the same.&lt;/P&gt;&lt;PRE&gt;myIndex.attachWith(&lt;SPAN&gt;new &lt;/SPAN&gt;ReceiverBehavior() {&lt;BR /&gt;    &lt;SPAN&gt;public void &lt;/SPAN&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;(OutputStream stream) &lt;SPAN&gt;throws &lt;/SPAN&gt;IOException {&lt;BR /&gt;        Writer out = &lt;SPAN&gt;new &lt;/SPAN&gt;OutputStreamWriter(stream&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"UTF8"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        for &lt;/SPAN&gt;(&lt;SPAN&gt;int &lt;/SPAN&gt;i = &lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;i &amp;lt; &lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;i++) {&lt;BR /&gt;            out.write(&lt;SPAN&gt;"This is my msg"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;        }&lt;BR /&gt;        out.flush()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;})&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;We are referring&amp;nbsp;&lt;A href="https://dev.splunk.com/enterprise/docs/java/sdk-java/howtousesdkjava/howtogetdatasdkjava" target="_blank"&gt;https://dev.splunk.com/enterprise/docs/java/sdk-java/howtousesdkjava/howtogetdatasdkjava&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 10:04:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Send-Arguments-in-attachWith-host-sourcetype-and-time/m-p/509489#M86665</guid>
      <dc:creator>akshgpt25</dc:creator>
      <dc:date>2020-07-16T10:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Send Arguments in attachWith - host,sourcetype and time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Send-Arguments-in-attachWith-host-sourcetype-and-time/m-p/547593#M91128</link>
      <description>&lt;P&gt;I am also facing the same problem with attachWith(), we are using Splunk Java SDK 1.6.X. any help updates on it.&lt;/P&gt;&lt;P&gt;Hassan&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 11:25:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Send-Arguments-in-attachWith-host-sourcetype-and-time/m-p/547593#M91128</guid>
      <dc:creator>royalhrk</dc:creator>
      <dc:date>2021-04-12T11:25:59Z</dc:date>
    </item>
  </channel>
</rss>

