3735
|
1 --- |
|
2 summary: JSON Log Sink |
|
3 --- |
|
4 |
|
5 Conifiguration |
|
6 ============== |
|
7 |
|
8 ``` {.lua} |
|
9 log = { |
|
10 -- your other log sinks |
|
11 info = "/var/log/prosody/prosody.log" |
|
12 -- add this: |
|
13 { to = "json", filename = "/var/log/prosody/prosody.json" }; |
|
14 } |
|
15 ``` |
|
16 |
|
17 Format |
|
18 ====== |
|
19 |
|
20 JSON log files consist of a series of `\n`-separated JSON objects, |
|
21 suitable for mangling with tools like |
|
22 [`jq`](https://stedolan.github.io/jq/). |
|
23 |
|
24 ``` {.json} |
|
25 {"message":"Client connected","source":"c2s55f267f5b9d0","datetime":"2019-11-03T13:38:28Z","level":"info","args":[]} |
|
26 {"message":"load_roster: asked for: %s","source":"rostermanager","datetime":"2019-11-03T13:38:28Z","level":"debug","args":["user@example.net"]} |
|
27 ``` |
|
28 |
|
29 `datetime` |
|
30 : [XEP-0082]-formatted timestamp. |
|
31 |
|
32 `source` |
|
33 : Log source, usually a module or a connected session. |
|
34 |
|
35 `level` |
|
36 : `debug`, `info`, `warn` or `error` |
|
37 |
|
38 `message` |
|
39 : The log message in `printf` format. Combine with `args` to get the |
|
40 final message. |
|
41 |
|
42 `args` |
|
43 : Array of extra arguments, corresponding to `printf`-style `%s` |
|
44 formatting in the `message`. |