watch_file
Monitor files for changes or specific patterns to detect events like errors, build completions, or job status updates. Polls a file periodically and returns matching lines.
Instructions
Watch a file for changes or a specific pattern.
Useful for monitoring log files, build outputs, job status files.
Examples:
- Watch a log: path="/var/log/app.log", pattern="ERROR|FATAL"
- Wait for file: path="/tmp/job_done.flag", pattern=""
- Tail a build log: path="build.log", pattern="BUILD SUCCESS|BUILD FAILURE"
Args:
path: File path to watch.
pattern: Regex pattern to stop on when found in the file. Leave empty to stop on any change.
timeout_seconds: Max seconds to watch (default 300, max 3600).
interval_seconds: Seconds between checks (default 5, min 2).
tail_lines: Number of lines from end of file to return (default 50).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| pattern | No | ||
| tail_lines | No | ||
| timeout_seconds | No | ||
| interval_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |