![]() Basically, the code needs to be running in order for Visual Studio Code to attach.įinally, start the debugger in Visual Studio Code. If you are debugging a custom alert action, create a search to trigger the action. If you are debugging a custom search command, start a Splunk search and invoke the command. For instance, if you are debugging a modular input, create an instance of the input and enable it. Next, start the component you want to debug on the Splunk Enterprise server. These lines of code enable the Visual Studio Code debugger to connect and debug the Python code running in Splunk Enterprise. The detailed steps for debugging are documented in the supporting add-on and this Wiki, so I will cover the gist here for brevity.įirst, on the Splunk Enterprise side, you will need to add a few lines of Python code to the component you want to debug. The server running Splunk Enterprise requires the Visual Studio Code Supporting Add-on for Splunk. ![]() The workstation running Visual Studio Code requires the Visual Studio Code Splunk extension. Technically these things can run on the same logical machine however, Visual Studio Code can run on a workstation while Splunk Enterprise runs in a remote data center or even a public cloud.Įach component requires specific software. A machine running Splunk Enterprise software.A machine, like a workstation, running Visual Studio Code.There has to be a better way – and now there is! This integration allows you to set breakpoints, step into/over code, inspect the call stack, and more. To figure out what is actually happening inside the code, maybe you add a plethora of debug logging statement, or purposely throw an exception, or write output to files somewhere in order to figure out what is happening behind the scenes. If you’re imperfect like me, you might get an error or unexpected results or no results at all. The Developer PersonaĪfter spending some time creating your shiny new Splunk extension, you’re ready to test it out. conf files and interact with Splunk via the editor. ![]() Visual Studio Code is very extensible, and this integration takes advantage of the extensibility to provide intelligence about Splunk. Visual Studio Code is a free, cross-platform, highly rated code editor from Microsoft that provides a rich development environment including debugging capabilities such as breakpoints, stepping into code, variable inspection, and displaying the call stack. If you fit one of those personas, you are in luck because I’m happy to tell you about some new Splunk integrations with Visual Studio Code in this blog.
0 Comments
Leave a Reply. |