Commit 08d9d88
feat(logs): derive default log sources from agent capabilities (#112)
APILogSourcesHandler returned a hardcoded [haproxy, system] pair
whenever no explicit per-box settings existed. On a box whose agent
has no `logs` (journalctl) or `access-log` gear — e.g. mjolnir's
distroless container agent — the Logs page would still load both
defaults and then trip every fetch against the agent, which has
nothing to serve. Combined with the plain-text 5xx error responses
(see #112 / sibling PR #114) this produced the user-visible
"Error loading logs: Unexpected token 'F'" toast.
Drive the no-settings default off the agent's probe table:
* `haproxy` is offered when either access-log OR logs gear is
available (access-log streams directly from /var/log/haproxy; the
logs gear can serve it via journalctl/file too).
* `system` is offered only when the `logs` gear is available (it
needs journalctl/tail).
* If the agent has neither, return an empty source list — the JS
renders an empty dropdown and skips the immediate fetch instead
of 5xx-storming.
* If capabilities aren't reachable at all (agent down, older agent
that pre-dates probing) fall back to the legacy pair so existing
deployments still work through transient outages.
Phase 2 slice of #112.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0799f82 commit 08d9d88
1 file changed
Lines changed: 64 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
52 | 67 | | |
53 | 68 | | |
54 | 69 | | |
| |||
64 | 79 | | |
65 | 80 | | |
66 | 81 | | |
67 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
68 | 85 | | |
69 | 86 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 87 | + | |
| 88 | + | |
75 | 89 | | |
76 | 90 | | |
77 | 91 | | |
| |||
92 | 106 | | |
93 | 107 | | |
94 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
0 commit comments