Getting Data In

How to enable rest-api?

rajanshrivastav
Path Finder

Hi Team,

I'm running Splunk on AWS ec2 instance backed by AWS ALB.
I've created target group for port 80,443 & 8089 for splunk. Security groups & network ACL are already opened for these ports.
But whenever I do "curl -k http://localhost:8089/en-us",
it says -- "curl: (56) Recv failure: Connection reset by peer"

I'm accessing it as a root user , also I've admin credentials as well.

Please let me know how I can access this port, I've a requirement to enable rest-api. I checked for other articles but I didn't find any satisfactory answers. I got to know that rest-api works for everyone, but in my case it is not working.

Please help me enabling rest-api features.

Thanks,

0 Karma

MuS
Legend

Hi rajanshrivastav786,

But whenever I do "curl -k
http://localhost:8089/en-us",
Your problem is that you are using port 8089 AND http, the management port and therefore the REST API uses SSL by default.

Just use curl -k https://localhost:8089/ instead and it works.

cheers, MuS

inventsekar
SplunkTrust
SplunkTrust

As per my knowledge, there is no enable/disable for rest API.
(Maybe, roles/capabilities issue can occur)

To verify, Simply run...(replace the admin:changeme to your username:password)

curl -k -u admin:changeme https://localhost:8089/services/search/jobs --data-urlencode 'search=search index="_internal" | head 1'

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
0 Karma

rajanshrivastav
Path Finder

After running above command, it is showing following result-

1536009195.1426

0 Karma

rajanshrivastav
Path Finder

"

1536009195.1426

"

0 Karma

rajanshrivastav
Path Finder

Blockquote

1536009195.1426

Blockquote

0 Karma
Get Updates on the Splunk Community!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...