Getting Data In

Can I call REST Endpoint of Universal Forwarder to pass log data from code?

Splunk_Shinobi
Splunk Employee
Splunk Employee

Hi

Can I call REST Endpoint of Universal Forwarder to pass log data from code?
* not creating new monitor configuration

I am currently using storm to push the data using API call from code.
I am looking for any information how I can do this using universal
forwarder to pass the data to my distributed indexer environment.

Thanks,

0 Karma
1 Solution

melonman
Motivator

I did Simple test, and found that if you don't have index definition in UF, the rest call will return error, but if you do, it will eat the data.

I am not sure if this is supported or not..

My environment looks like : SH/INDEXER:9997 <- UniversalForwarder:8089

and used this call:

curl -k -u admin:changeme "https://localhost:8089/services/receivers/simple?index=myindex&source=www&sourcetype=test" -d "`date '+%s'` from API"

In case without indexes.conf in your UF, the curl command returns:

$ curl -k -u admin:changeme "https://localhost:8089/services/receivers/simple?index=myindex&source=www&sourcetype=test" -d "`date '+%s'` from API"

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <messages>
    <msg type="WARN">supplied index missing or disabled</msg>
  </messages>
</response>

if you have this entry in indexes.conf in UF,

$ cat indexes.conf 
[main]
[myindex]

then, the call went OK.

$ curl -k -u admin:changeme "https://localhost:8089/services/receivers/simple?index=myindex&source=www&sourcetype=test" -d "`date '+%s'` from API"
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <results>
    <result>
      <field k="_index">
        <value>
          <text>myindex</text>
        </value>
      </field>
      <field k="bytes">
        <value>
          <text>19</text>
        </value>
      </field>
      <field k="host">
        <value>
          <text>127.0.0.1</text>
        </value>
      </field>
      <field k="source">
        <value>
          <text>www</text>
        </value>
      </field>
      <field k="sourcetype">
        <value>
          <text>test</text>
        </value>
      </field>
    </result>
  </results>
</response>
$ 

View solution in original post

0 Karma

dominiquevocat
SplunkTrust
SplunkTrust

maybe this is of some use? https://splunkbase.splunk.com/app/2775/ (soon to be updated in time for .conf 2017 🙂 )

0 Karma

melonman
Motivator

I did Simple test, and found that if you don't have index definition in UF, the rest call will return error, but if you do, it will eat the data.

I am not sure if this is supported or not..

My environment looks like : SH/INDEXER:9997 <- UniversalForwarder:8089

and used this call:

curl -k -u admin:changeme "https://localhost:8089/services/receivers/simple?index=myindex&source=www&sourcetype=test" -d "`date '+%s'` from API"

In case without indexes.conf in your UF, the curl command returns:

$ curl -k -u admin:changeme "https://localhost:8089/services/receivers/simple?index=myindex&source=www&sourcetype=test" -d "`date '+%s'` from API"

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <messages>
    <msg type="WARN">supplied index missing or disabled</msg>
  </messages>
</response>

if you have this entry in indexes.conf in UF,

$ cat indexes.conf 
[main]
[myindex]

then, the call went OK.

$ curl -k -u admin:changeme "https://localhost:8089/services/receivers/simple?index=myindex&source=www&sourcetype=test" -d "`date '+%s'` from API"
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <results>
    <result>
      <field k="_index">
        <value>
          <text>myindex</text>
        </value>
      </field>
      <field k="bytes">
        <value>
          <text>19</text>
        </value>
      </field>
      <field k="host">
        <value>
          <text>127.0.0.1</text>
        </value>
      </field>
      <field k="source">
        <value>
          <text>www</text>
        </value>
      </field>
      <field k="sourcetype">
        <value>
          <text>test</text>
        </value>
      </field>
    </result>
  </results>
</response>
$ 
0 Karma

melonman
Motivator

If you want to send to an index that doesn't exist locally, pass "check-index=false" as a GET parameter to the call.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...