Splunk Dev

Connect to Python API through base url and .splunkrc

splunkreal
Motivator

We are using /api base url, is that correct for .splunkrc as it asks for host and in our environment we use url?

thanks for your help!

 

.splunkrc

# Splunk host (default: localhost)

host=splunkurl/api

# Splunk admin port (default: 8089)

port=443

# Splunk username

username=

# Splunk password

password=

# Access scheme (default: https)

scheme=https

# Your version of Splunk (default: 6.3)

version=9.0.4

 

* If this helps, please upvote or accept solution if it solved *
Tags (2)
0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@splunkreal - For the host you need to just IP address or hostname. The port should be a Splunk management port generally 8089 and not the Splunk UI port.

 

I hope this helps!!!

splunkreal
Motivator

Hello, thanks so how would you connect from Python using base url? We have HA/FO servers in front of Splunk servers.

* If this helps, please upvote or accept solution if it solved *
0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

HA/FO shouldn't affect the URL for API for Splunk.

Base URL should be constructed as https://<host/ip>:8089 

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Theoretically, of course a reverse-proxy could affect a URI path of the request redirecting it into somewhere else on the backend but that would need to be explicitly configured.

Anyway see the https://docs.splunk.com/Documentation/Splunk/latest/RESTUM/RESTusing document and see the remark about namespaces on https://docs.splunk.com/Documentation/Splunk/9.1.3/RESTREF/RESTlist

0 Karma

splunkreal
Motivator

Hi @PickleRick  we use base url api already for curl commands and would like to use in python.

* If this helps, please upvote or accept solution if it solved *
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Just set host and port and let the splunklib handle the rest.

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@splunkreal - Did you got to resolve your issue?

0 Karma

splunkreal
Motivator

Hi @VatsalJagani  no, we need to use base url api. Thanks.

* If this helps, please upvote or accept solution if it solved *
0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...