sshexec
Executes a shell command on a remote host using an SSH profile. Runs the command after all previous pipeline stages have completed.
Command properties
| Item | Description |
|---|---|
| Command type | Transforming |
| Required permission | Administrator |
| License usage | N/A |
| Parallel execution | Not supported |
| Distributed execution | Not supported |
Syntax
Target
PROFILE- SSH profile name. Specify an SSH connection profile registered in the system.
COMMAND- Shell command to execute on the remote host. You can use query parameters (
${}) to construct the command dynamically.
Error codes
Parse errors
| Error code | Message | Description |
|---|---|---|
| no-permission | (dynamic message) | The user does not have administrator permission. |
| missing-options | (dynamic message) | The profile name or command is not specified. |
| invalid-ssh-profile | (dynamic message) | The specified SSH profile is not registered. |
Runtime errors
N/A
Description
The sshexec command connects to the remote host via SSH after all previous pipeline stages complete, then executes the specified shell command. The command execution result is not included in the query output.
If an error occurs during command execution, the error is logged and the connection is terminated.
This command requires administrator permission.
Examples
-
Execute a script on a remote server
table duration=1d WEB_APACHE | stats count by src_ip | outputcsv /tmp/report.csv src_ip, count | sshexec myprofile /opt/scripts/process_report.shAggregates web server access logs, saves them as CSV, then connects to the remote server using the
myprofileSSH profile to run a post-processing script. -
Execute a dynamic command using query parameters
set target_dir="/data/reports" | sshexec myprofile ls ${target_dir}Inserts the query parameter
target_dirinto the command to list the specified directory on the remote server.