tail_log
Isolate errors in logs by reading the last lines of files under /var/log, with optional substring filtering for quick diagnosis.
Instructions
Read the last N lines of a log file, optionally filtered by substring.
For safety, reads are restricted to allowed log roots (default: /var/log) and capped at 500 lines. Symlinks are resolved before the check, so links pointing outside the allowed roots are rejected.
Returns: str: The matching log lines, or an actionable error message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| grep | No | Case-insensitive substring filter applied before the line limit (e.g. 'error', 'oom'). | |
| path | Yes | Absolute path to a log file under an allowed root (/var/log), e.g. '/var/log/syslog'. | |
| lines | No | Number of lines from the end of the file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |