-
Notifications
You must be signed in to change notification settings - Fork 27
Remote Debugging using SSH
Remote Debugging using SSH allows you to use Visual Studio Code locally regardless of where Splunk Enterprise is running, including public cloud providers, as long as SSH connectivity is available. No source code needs to be on your local machine since all execution happens on the remote instance.
Local Machine:
Remote Machine:
Remote access to a machine can be accomplished via username and password or an SSH public/private key pair. Key-based authentication is highly recommended.
If you do not have an SSH key pair, open a bash shell or command line and run the following command to generate one:
ssh-keygen -t rsa -b 2048
You will need to add the SSH key to your remote SSH host which will vary and is beyond the scope of this walkthrough.
The Remote SSH extension, which is installed by the Visual Studio Code Splunk Extension, adds an indicator to the bottom-left corner of the Status Bar in Visual Studio Code indicating the context in which Visual Studio Code is running (local or remote). Click on this indicator to bring up a list of Remote Extension commands.
Choose the Remote-SSH: Connect to Host command.
images/remote-ssh_connect_host
Specify the username@hostname
where username is the username
associated with the SSH key, and hostname
is the remote Splunk instance.
A new instance of Visual Studio Code will open that is connected to the remote Splunk instance.
Choose Open folder...
Type in the path to your Splunk app location and click the OK button
By default, the Python extension is not enabled for SSH. Click the Extensions button (1) in the Activity bar on the left, and then click the Install in SSH button (2) for the Python extension.
You can now debug using the same techniques as if you were connected locally.
Ensure your SSH credentials have read permissions to necessary files.