Query Syslog
query_syslogQuery ServiceNow syslog to retrieve error, warning, and debug entries with timestamps and sources. Monitor script execution and debug issues after deployments.
Instructions
Query the ServiceNow system log (syslog) to check for errors, warnings, and debug output. Returns log entries with timestamps, levels, sources, and messages. Results are ordered newest-first.
Useful for monitoring script execution results, checking for errors after deployments, and debugging issues. Can be called repeatedly to check for new entries. Use the 'syslog' table for system-level logs and 'syslog_app_scope' for scoped application logs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance | No | The ServiceNow instance auth alias (e.g., "myinstance", "prod"). If not provided, falls back to the SN_AUTH_ALIAS environment variable. | |
| query | No | A ServiceNow encoded query string for additional filtering. Example: "messageLIKEscript error^source=sys_script". This is combined with any level/source filters specified below. | |
| level | No | Filter by log level. Only returns entries at the specified level. | |
| source | No | Filter by log source (e.g., "sys_script", "workflow"). Exact match. | |
| limit | No | Maximum number of syslog entries to return. Default is 50. | |
| table | No | Which syslog table to query. Use "syslog" for the main system log, or "syslog_app_scope" for scoped application logs which include the application scope field. | syslog |