Splunk Dev

recommendations for a visual debugger for python code run by Splunk

Justin_Grant
Contributor

When developing python code that interacts with Splunk, what's a good visual debugger that works well with Splunk's Python installation? And how should I configure it to debug the following:

  • custom EAI handlers
  • scripted inputs
  • custom search commands

This is needed both for debugging my own code and also for stepping into other parts of Splunk. For example, if I make a typo in my setup.xml handler, I end up with an error message but no easy way to figure out what's causing the problem. So it'd be useful to be able to set a breakpoint in SplunkWeb code and step through it until it hits an exception.

I know there's a Python command-line debugger (PDB), but after using IDE debuggers for 20 years, I'm loath to go back to command line debugging if I don't have to.

UPDATE: I've installed Eclipse with PyDev as well as Wing IDE. Using either debugger, I can successfully set breakpoints as SplunkWeb is starting up, but can't figure out how to get a breakpoint to break into the debugger on a line of code inside the execution of a manager page (either my custom EAI endpoint code, or the Splunk code in admin.py).

Any suggestions?

0 Karma

jrodman
Splunk Employee
Splunk Employee

My opinionated view is that debugging in python is rarely worth it. Logging and exceptions usually get you there faster and more reliably. I'd add logging to your program, and trap exceptions into the log. Now you have continuous debug ability, and you have debugging already wired in for problems you don't know about.

As for your stated goal, I have no useful suggestions. I'm not informed because in my python programming, I've never found a debugger useful.

Justin_Grant
Contributor

Have you been able to set breakpoints within custom EAI endpoints and have the debugger pop up? I've got basic debugging working with Wing IDE and Eclipse, but getting debugging of my own custom code is still beyond my reach.

0 Karma

Lowell
Super Champion

Active State's Komodo has a decent python debugging; last time I looked. (Although more recently I've been using the free Komodo-Edit instead of my older version of Komodo that was licensed, so I can't speak about recent versions.) I also point out Komodo partially because splunk already recommends using Komodo Edit (http://www.splunk.com/base/Documentation/latest/Developer/Step1GettingStarted) for editing other config and XML files.

0 Karma
Get Updates on the Splunk Community!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...