logs command bring your application logs into the terminal: tail them as they arrive, search across a time range, and manage the log-derived metrics and log-based triggers built from them.
Common options
Everylogs command identifies one application, and uses your default organization unless you tell it otherwise:
Tail logs
Stream log lines as they arrive (the CLI polls every second):Shell
Search logs
Search past log lines and print the matches. For example, find recent error-level lines:Shell
search returns up to 100 of the most recent matches. On top of the common options and filters, it adds:
To pull every line in a window as JSON, for a script or agent:
Shell
Filters
tail and search share these filters:
List the views available for an app with
appsignal-cli logs views, then pass one to --view by name or ID. Any other filters you add override the view’s saved defaults. For example, apply a view but narrow it to critical lines:
Shell
Query syntax
The--query flag uses AppSignal’s log query syntax. Common patterns:
severity=error: exact field matchmessage:timeout: message contains “timeout”group=notifiers: exact group matchhostname:web-1: hostname contains “web-1”- Space-separated terms combine with
AND; useORfor alternatives
message:"[Email]".
Saved views and sources
List an app’s saved log views (filter presets) and its log sources:Shell
--view, and a source’s ID to --source-ids.
Log-derived metrics
logs metrics turns matching log lines into metrics, with list, create, update, and delete:
Shell
create and update share these flags (create requires --name, --query, and at least one --metric):
update can take the following additional flags. The --clear-* flags empty fields instead of updating them.
delete takes only --id.
A log-derived metric only starts collecting data once it’s scoped to a log source, so pass
--source-id (find IDs with appsignal-cli logs sources). The CLI can’t set a metric’s severity filter; if your metric needs one, set the Severity field in the AppSignal app UI after creating it.Log-based triggers
logs triggers alerts on matching log lines, with list, create, update, and delete:
Shell
create and update share these flags (create requires --name and --query):
update can take the following additional flags. The --clear-* flags empty fields instead of updating them.
delete takes only --id.
These are log-based triggers, built from log lines. For anomaly detection triggers on metrics, see Triggers.