Splunk Dev

Splunklib.client: request failed session is not logged in

tmontney
Builder

Edit: I am using the correct token, it's my instance that's wrong. This instance is on my local machine for easy development. My other two servers work fine. I moved my app over to my test server, and it works fine.

Building my own rest handler which accesses storage_passwords. I assume I'm using the wrong token? I don't know the structure of "self" here.

 

import splunk, base64, sys, os, time, json, re, shutil, subprocess, platform, logging, logging.handlers
from splunk.persistconn.application import PersistentServerConnectionApplication
import splunklib.client as client

class req(PersistentServerConnectionApplication):
    def __init__(self, command_line, command_arg):
        PersistentServerConnectionApplication.__init__(self)

    def handle(self, in_string):
        authtoken = json.loads(in_string)["session"]["authtoken"]
        logger.debug(authtoken)
        service = client.connect(token=authtoken)
        storage_passwords = service.storage_passwords

 

 

 

Hardcoding the credentials, I just get "login failed". I'm thinking this is related to my other post https://community.splunk.com/t5/Dashboards-Visualizations/Credentials-not-accepted-for-port-8089/m-p.... Browsing 8089, I also cannot log on with any credential.

Labels (1)
0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...