Query System Logs
servicenow_query_logsRetrieve ServiceNow system log entries by level, source, or time window to identify errors, warnings, and debug messages for troubleshooting.
Instructions
Query the ServiceNow system log (syslog table) for errors, warnings, and debug messages.
Args:
query (string): Encoded query filter (e.g., 'level=3', 'sourceLIKEBusinessRule', 'messageLIKEError')
level (string): Minimum log level to include: 'debug'(0), 'info'(1), 'warning'(2), 'error'(3). Default: 'warning'
source (string): Filter by log source (e.g., 'BusinessRule', 'ScriptInclude', 'Workflow')
since_minutes (number): Only return logs from the last N minutes (default: 60)
limit / offset: Pagination
response_format: Output format
Log levels: 0=Debug, 1=Info, 2=Warning, 3=Error
Returns: Log entries with timestamp, level, source, and message
Examples:
Recent errors → level="error"
Business rule failures → source="BusinessRule", level="error"
Logs for a specific operation → query="messageLIKEMyScriptInclude"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| level | No | Minimum log level (default: warning) | warning |
| limit | No | Maximum number of results to return (1–100, default 20) | |
| query | No | Encoded ServiceNow query string (e.g., 'state=1^priority=1^assigned_to=javascript:gs.getUserID()'). Leave empty to return all records. | |
| offset | No | Number of results to skip for pagination (default 0) | |
| source | No | Filter by log source (partial match) | |
| since_minutes | No | Only logs from the last N minutes (default: 60) | |
| response_format | No | Output format: 'markdown' (default) for human-readable or 'json' for structured data | markdown |