Search logs
Read and filter what an app's containers printed, and the log lines of schedules, functions, event rules, load balancers and CDN distributions.
Six kinds of resource ship log lines to Monitoring:
resourceType |
What its lines are |
|---|---|
app (default) |
What the app's containers write to stdout and stderr |
schedule |
A schedule's invocations, one stream per invocation |
function |
A function's output |
event_rule |
An event rule's deliveries, one stream per delivery |
load_balancer |
An application load balancer's requests |
cdn_distribution |
A CDN distribution's requests (stream access) and web ACL matches (waf) |
An app's stream is <service>/stdout or <service>/stderr: a single-image app's service is app,
a compose app's the compose service name. The agent on the app's machine ships its lines about every
ten seconds. Replace app-id with the resource's id.
Prerequisites
- Permission for
monitoring:FilterLogEventsonrn:ews::<organization id>:monitoring:*. Without it, Logs shows an access-denied notice. - In the console, the Logs page lists application load balancers only with
lb:DescribeLoadBalancersand CDN distributions only withcdn:ListDistributions.
Read the lines
- Open Monitoring, then Logs. An app's own page has the same view of its lines under its Logs tab, with at most 200 lines.
- Choose the source: an app, a load balancer or a CDN distribution.
- (Optional) Type in Lines containing… to show only lines that contain the text, in any case.
- Choose a range: 1 hour, 6 hours, 24 hours or 7 days.
The newest line is at the bottom, and new lines keep arriving while the view is live; Pause stops that. The view shows at most 1000 lines. Times are UTC.
dcloud monitoring logs filter --resource-id app-id --contains error --limit 500GET /monitoring/api/logs?resourceId=app-id&contains=error&limit=500For another kind of resource, add resourceType, for example resourceType=function.
Result
The API answers { start, end, events }: up to limit lines (200 by default, at most 1000),
newest first, each with its stream, ts and message. start defaults to a day before end,
and end to now. contains matches regardless of case, and % and _ in it are taken literally;
stream matches one stream exactly. An id your organization does not have answers no lines.
Limits
- Lines are kept 7 days.
- An app's line longer than 16 KiB is cut and ends in
…[truncated]. - When an app prints faster than its machine can ship, the agent keeps at most 5000 lines waiting and drops the rest; the app's activity says how many.
- The agent ships what containers print from the moment it starts; earlier output stays on the machine.
Related
Related