Skip to content

Commit 7a55e75

Browse files
authored
Merge pull request #8632 from chrischdi/pr-book-jq-logging
📖 testing: add jq variant for inspecting json logs
2 parents 91277b5 + 80a04c8 commit 7a55e75

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/book/src/developer/testing.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,24 @@ analyzing them via Grafana.
339339

340340
</aside>
341341

342+
As alternative to loki, JSON logs can be visualized with a human readable timestamp using `jq`:
343+
344+
1. Browse the ProwJob artifacts and download the wanted logfile.
345+
2. Use `jq` to query the logs:
346+
347+
```bash
348+
cat manager.log \
349+
| grep -v "TLS handshake error" \
350+
| jq -r '(.ts / 1000 | todateiso8601) + " " + (. | tostring)'
351+
```
352+
353+
The `(. | tostring)` part could also be customized to only output parts of the JSON logline.
354+
E.g.:
355+
356+
* `(.err)` to only output the error message part.
357+
* `(.msg)` to only output the message part.
358+
* `(.controller + " " + .msg)` to output the controller name and message part.
359+
342360
### Known Issues
343361

344362
#### Building images on SELinux

0 commit comments

Comments
 (0)