Skip to main content

scout logs

Query logs for a specific service from the Scout platform. Filter by severity, body content, attributes, and more.

scout logs demo

Usage​

scout logs <SERVICE> [flags]

Arguments​

ArgumentTypeDescription
SERVICEstring(required) Service name to query logs for

Flags​

FlagTypeDefaultDescription
--severitystring—Severity levels, comma-delimited. Repeatable. Values: INFO, WARN, ERROR, DEBUG, FATAL
--containsstring—Filter by body substring (case-insensitive)
--attrKEY=VALUE—Filter by log attribute. Repeatable (AND logic)
--resourceKEY=VALUE—Filter by resource attribute. Repeatable (AND logic)
--trace-idstring—Filter by trace ID
--sinceduration5mTime window (max: 15 minutes). Conflicts with --start
--startRFC 3339—Start time. Conflicts with --since
--endRFC 3339—End time. Requires --start
--limitinteger100Maximum number of results (max: 1000)
--rawboolfalseOutput JSON
--body-onlyboolfalseOutput only log bodies, one per line. Conflicts with --raw
--discoverboolfalseShow available log metadata instead of querying
--wideboolfalseShow full log bodies without truncation
--environment <ENV>string—Restrict results to records tagged with this environment resource attribute (e.g. production, staging). Records without that resource attribute are filtered out.

Examples​

Query recent logs for a service:

scout logs payment-service

Filter by severity:

scout logs payment-service --severity ERROR,WARN

Search log bodies:

scout logs payment-service --contains "timeout" --since 10m

Filter by attributes:

scout logs payment-service --attr user_id=123 --resource environment=development

Correlate with a trace:

scout logs payment-service --trace-id abc123def456

Restrict to a specific deployment environment:

scout logs payment-service --environment development

Output only log bodies:

scout logs payment-service --body-only

Discover available metadata:

scout logs payment-service --discover

Attribute Filtering​

Use --attr and --resource to filter by key-value pairs. Multiple filters of the same type use AND logic.

# Both conditions must match
scout logs payment-service --attr user_id=123 --attr action=checkout
tip

Use --discover to see available attribute keys and severity values before building a targeted query.

warning

The maximum time range is 15 minutes. For longer queries, use --start and --end with explicit timestamps.

See Also​

  • traces — query distributed traces
  • metrics — query service metrics
  • alerts — query alert history
Was this page helpful?