Splunk Dev

What are the arguments for entity.getEntities?

jwhughes58
Contributor

All,

I've got this code

#########################################################################
# Imports for Splunk
#########################################################################
import splunk.entity as entity

try:
    from splunk.clilib.bundle_paths import make_splunkhome_path
except ImportError:
    from splunkappserver.mrsparkle.lib.util import make_splunkhome_path

########################################
# get our config data returns a dict
########################################
def getConfig(sessionKey,nameSpace):
    try:
        resp = entity.getEntities(['properties', 'verodin', 'verodin'], namespace=nameSpace, owner='nobody', sessionKey=sessionKey)
    except Exception, e:
        raise Exception(" Could not get %s credentials from splunk. Error %s" % (nameSpace, str(e)))

    config = {}

    for k, v in resp.items():
        config[str(k)] = str(v)

    return config

Another member of the team got it working. I'm trying to create new code but I don't understand what the getEntities first argument is beyond a list. I've seen examples with [admin, password] but I haven't found a good example or documentation explaining how this works. Any idea?

TIA,
Joe

Labels (2)
0 Karma
1 Solution

jwhughes58
Contributor

One of my coworkers and I discussed this and all the pieces fell into place for me mentally. For ['properties', 'verodin', 'verodin'] the fields can be found using https://splunk_host:8089/services.

First item in list properties can be found at the top level when logged into the above website.
Drill down into properties.
Second item in list verodin is the name of the default/verodin.conf file. As Tom noted at the top level of the TA a README directory is needed with a verodin.conf.spec file in it.
Drill down into verodin.
Third item in list verodin is the stanza inside the default/verodin.conf file.
Drill down into it and there should be list of the items under the stanza.

View solution in original post

0 Karma

jwhughes58
Contributor

One of my coworkers and I discussed this and all the pieces fell into place for me mentally. For ['properties', 'verodin', 'verodin'] the fields can be found using https://splunk_host:8089/services.

First item in list properties can be found at the top level when logged into the above website.
Drill down into properties.
Second item in list verodin is the name of the default/verodin.conf file. As Tom noted at the top level of the TA a README directory is needed with a verodin.conf.spec file in it.
Drill down into verodin.
Third item in list verodin is the stanza inside the default/verodin.conf file.
Drill down into it and there should be list of the items under the stanza.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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