carlos / carloku Public

Clone
git clone https://amadan.net/carlos/carloku

Plain git — no account needed to clone.

Download

Download this file

1# Logs
2
3`carlos logs` is one timeline rather than two. Your app's own stdout and
4stderr come back interleaved with the platform's account of what happened to
5it — which instance woke and on what version, when something restarted it,
6and when a wake failed, with the reason.
7
8```sh
9carlos logs -app hello -since 1h
10```
11
12Lines print oldest to newest: a UTC timestamp, the stream, the instance, the
13message, and any structured fields your app attached, dimmed at the end.
14
15## Following
16
17`-f` leaves the command running and polls for new lines every two seconds.
18
19```sh
20carlos logs -app hello -f
21```
22
23It runs close to live, not exactly live. Boxes ship what they have collected
24every ten seconds or so, so a follow arrives in small batches instead of
25scrolling a character at a time. Start one before a deploy and you will see
26the wake and the first requests.
27
28## Cutting it down
29
30An hour of a busy app is more than anyone reads. `-since` takes a duration
31back from now (`15m`, `24h`) or an RFC3339 timestamp, and `-until` closes the
32far end of the window. `-grep` matches an RE2 pattern against the message.
33`-host` narrows to a single instance when the app runs more than one. `-n`
34caps how many lines come back — a thousand by default, five thousand at most
35— and when the window has more than that, it tells you it is showing the
36newest.
37
38There is also `-stream`. `-stream app` drops the platform's commentary and
39leaves your own output; `-stream platform` does the opposite.
40
41## The half you can't get any other way
42
43Your app's output you could always have arranged for yourself. The platform
44stream is the part that needs a view from outside the process: `instance woke
45(version a1b2c3)`, `instance restarting (carlos restart)`, `instance
46stopping`, and — when a request got a 503 you cannot reproduce — a wake
47failure written in terms you can act on, like a socket left behind by a
48previous run, or nothing promoted on the channel this instance follows.
49
50A static site has no process and so has no app stream at all. Its platform
51events still show up, and they are the reason to run `carlos logs` against a
52site.
53
54## How far back it goes
55
56Seven days, and a size ceiling per app that drops the oldest hour first if
57an app is unusually chatty. If you need a longer record than that, have the
58app ship its own copy somewhere; the platform's retention is sized for
59debugging this week.
60
61An empty result is usually honest, and worth a second look. Platform
62events only happen when something happens — a wake, a restart, a failure —
63so a quiet hour of a quiet app really does have nothing in it. Widen to
64`-since 24h` before you conclude that logging is broken.
65
66The remaining flags, including `-level` and the repeatable `-field`, are in
67[carlos logs](https://carlosframework.com/docs/cli/#carlos-logs).
68