You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(logs): clarify canister log trimming direction
Emphasize that an unfiltered fetch_canister_logs read trims the oldest
records (response ends with the newest record) while a filtered read
trims the newest records (response starts with the oldest matching
record). Bound the trimming by an unspecified max response size.
Also drop the stale duplicate "Canister logs (query call)" section
re-introduced by the merge from main, which carried a duplicate anchor
and pre-filter semantics.
Timestamp and index filters cannot be combined with `--follow`.
104
104
105
+
Filtering also changes which records are dropped when the selected logs exceed the response size. An unfiltered read trims the oldest records, so it returns the most recent logs (the output ends with the newest record). A filtered read trims the newest records instead, so it returns the oldest records that match the filter (the output starts with the oldest matching record), which lets you page forward through a range by advancing the start of the filter.
106
+
105
107
To output logs as JSON for programmatic processing:
When the selected logs do not all fit within a single response, they are trimmed to fit and the direction of trimming depends on whether a filter is provided.
3852
+
An unfiltered read trims the oldest log records (keeps the longest suffix), so the response ends with the newest log record.
3853
+
A filtered read trims the newest log records (keeps the longest prefix), so the response starts with the oldest log record satisfying the filter.
3854
+
Thus an unfiltered read surfaces the most recent activity, while a filtered read can page forward through logs starting from the beginning of the requested range.
3855
+
3842
3856
Conditions
3843
3857
3844
3858
```html
@@ -4440,60 +4454,6 @@ S with
4440
4454
4441
4455
```
4442
4456
4443
-
#### IC Management Canister: Canister logs (query call) {#ic-mgmt-canister-fetch-canister-logs}
4444
-
4445
-
This section specifies management canister query calls.
4446
-
They are calls to `/api/v3/canister/<ECID>/query`
4447
-
with CBOR content `Q` such that `Q.canister_id = ic_principal`.
4448
-
4449
-
The management canister offers the method `fetch_canister_logs`
4450
-
that can be called as a query call and
4451
-
returns logs of a requested canister.
4452
-
4453
-
Submitted request to `/api/v3/canister/<ECID>/query`
4454
-
4455
-
```html
4456
-
4457
-
E : Envelope
4458
-
4459
-
```
4460
-
4461
-
Conditions
4462
-
4463
-
```html
4464
-
4465
-
E.content = CanisterQuery Q
4466
-
Q.canister_id = ic_principal
4467
-
Q.method_name = 'fetch_canister_logs'
4468
-
|Q.nonce| <= 32
4469
-
is_effective_canister_id(E.content, ECID)
4470
-
S.system_time <= Q.ingress_expiry or Q.sender = anonymous_id
where the query `Q`, the response `R`, and a certificate `Cert` that is obtained by requesting the path `/subnet` in a **separate** read state request to `/api/v3/canister/<ECID>/read_state` satisfy the following:
4490
-
4491
-
```html
4492
-
4493
-
verify_response(Q, R, Cert) ∧ lookup(["time"], Cert) = Found S.system_time // or "recent enough"
4494
-
4495
-
```
4496
-
4497
4457
#### IC Management Canister: List canisters (query call) {#ic-mgmt-canister-list-canisters}
4498
4458
4499
4459
This section specifies the `list_canisters` management canister query call.
Copy file name to clipboardExpand all lines: docs/references/ic-interface-spec/management-canister.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -954,6 +954,10 @@ To filter canister logs, an optional filter can be provided and have one of the
954
954
-`by_idx` (`record { start : nat64; end : nat64 }`): only logs are returned whose `idx` is within the provided range (`start` is inclusive, but `end` is exclusive);
955
955
-`by_timestamp_nanos` (`record { start : nat64; end : nat64 }`): only logs are returned whose `timestamp_nanos` is within the provided range (`start` is inclusive, but `end` is exclusive).
956
956
957
+
When the logs selected for the response do not all fit within a single response, they are trimmed to fit, and the direction of trimming differs between filtered and unfiltered reads:
958
+
- An **unfiltered** read trims the **oldest** log records, so the response ends with the newest log record. This surfaces the most recent activity.
959
+
- A **filtered** read trims the **newest** log records, so the response starts with the oldest log record satisfying the filter. This lets a filtered read page forward through logs starting from the beginning of the requested range.
960
+
957
961
Cycles to pay for the call must be explicitly transferred with the call, i.e., they are not automatically deducted from the caller's balance implicitly (e.g., as for inter-canister calls).
0 commit comments