RunReveal

Command source

The command source executes a shell command on a configurable interval and captures each line of stdout as a log event. This is useful for collecting output from custom scripts, system utilities, or any program that writes to stdout.

Configuration

{
  "sources": {
    "system-info": {
      "type": "command",
      "cmd": "/bin/date",
      "args": ["+%Y-%m-%dT%H:%M:%S%z"],
      "interval": "30s"
    }
  }
}

Options

OptionTypeDefaultDescription
cmdstringrequiredCommand to execute
argsstring[]nullCommand arguments
inheritEnvboolfalseInherit the reveald process environment
envobjectnullEnvironment variables for the command. Overrides inherited env if both are set.
intervalduration"5s"Time between executions. The command must complete within this interval or it will be killed.

Examples

Run a custom log collection script

{
  "sources": {
    "custom": {
      "type": "command",
      "cmd": "/opt/scripts/collect-metrics.sh",
      "inheritEnv": true,
      "interval": "60s"
    }
  }
}

Run with custom environment

{
  "sources": {
    "timezone-check": {
      "type": "command",
      "cmd": "/bin/date",
      "args": ["+%Y-%m-%dT%H:%M:%S%z"],
      "inheritEnv": false,
      "env": {
        "TZ": "UTC"
      },
      "interval": "5s"
    }
  }
}

Event fields

FieldValue
sourceType"command"
rawLogLine from stdout
eventTimeCurrent time when the line is read
service.nameThe command name

On this page