Splunk Search

Debugging custom search commands

Marinus
Communicator

I've been tinkering with a custom search command that uses win32com.client.
When I try to invoke my search command I get the following error

(-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147200925), None)

I've tried to call the offending section using the bundled interpreter, and it works just fine.

./splunk cmd python

Any ideas I'm kinda stumped.
I really don't want to have my search command, exec an external interpreter.

== Update ==
I've implemented another version that execs a vbs script to invoke the win32 com component.
It also fails which leads me to believe that splunkd is doing something funny.

1 Solution

Marinus
Communicator

Running splunk under a normal user account solves the problem.
On Windows splunk cmd python doesn't run in the same context as the service.

View solution in original post

0 Karma

Marinus
Communicator

Running splunk under a normal user account solves the problem.
On Windows splunk cmd python doesn't run in the same context as the service.

0 Karma

Drainy
Champion

I would follow http://splunk-base.splunk.com/answers/31262/sysstderr-not-logging-to-splunkd

I have been having issues with trying to find errors with custom commands and the link above has an answer which explains how to add logging information to your script so you can try to track where it is producing errors or how far it is going.

0 Karma

Marinus
Communicator

I am able to trap the error. The issue is what the splunkd process does to the environment that causes the python interpreter to behave differently.

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 Certification at ...

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 ...