For eg via below code i get the logs but how to get metrics from them and how i can use them in prometheus ?
import splunklib.client as client
import splunklib.results as results
service = client.connect(
host='host',
port=8089,
username='usr',
password='pwd')
query="search index=some index"
#rr = results.ResultsReader(service.jobs.export(query))
kwargs_export = { "output_mode": "json"}
rr = service.jobs.export(query)
for item in rr:
print(item)
Please try Prometheus Metrics for Splunk
app.
https://splunkbase.splunk.com/app/4077/