Software /
code /
prosody-modules
Annotate
mod_log_json/README.markdown @ 3745:e43a82ddde12
mod_log_json/README: Add a sentence about the first example
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 13 Nov 2019 17:51:08 +0100 |
parent | 3736:3784bbcbb8ff |
child | 3746:bc865568ff02 |
rev | line source |
---|---|
3735 | 1 --- |
2 summary: JSON Log Sink | |
3 --- | |
4 | |
5 Conifiguration | |
6 ============== | |
7 | |
3745
e43a82ddde12
mod_log_json/README: Add a sentence about the first example
Kim Alvefur <zash@zash.se>
parents:
3736
diff
changeset
|
8 Here we log to `/var/log/prosody/prosody.json`: |
e43a82ddde12
mod_log_json/README: Add a sentence about the first example
Kim Alvefur <zash@zash.se>
parents:
3736
diff
changeset
|
9 |
3735 | 10 ``` {.lua} |
11 log = { | |
12 -- your other log sinks | |
13 info = "/var/log/prosody/prosody.log" | |
14 -- add this: | |
15 { to = "json", filename = "/var/log/prosody/prosody.json" }; | |
16 } | |
17 ``` | |
18 | |
19 Format | |
20 ====== | |
21 | |
22 JSON log files consist of a series of `\n`-separated JSON objects, | |
23 suitable for mangling with tools like | |
24 [`jq`](https://stedolan.github.io/jq/). | |
25 | |
3736
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
26 Example (with whitespace and indentation for readability): |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
27 |
3735 | 28 ``` {.json} |
3736
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
29 { |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
30 "args" : [], |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
31 "datetime" : "2019-11-03T13:38:28Z", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
32 "level" : "info", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
33 "message" : "Client connected", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
34 "source" : "c2s55f267f5b9d0" |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
35 } |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
36 { |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
37 "args" : [ |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
38 "user@example.net" |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
39 ], |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
40 "datetime" : "2019-11-03T13:38:28Z", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
41 "level" : "debug", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
42 "message" : "load_roster: asked for: %s", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
43 "source" : "rostermanager" |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
44 } |
3735 | 45 ``` |
46 | |
47 `datetime` | |
48 : [XEP-0082]-formatted timestamp. | |
49 | |
50 `source` | |
51 : Log source, usually a module or a connected session. | |
52 | |
53 `level` | |
54 : `debug`, `info`, `warn` or `error` | |
55 | |
56 `message` | |
57 : The log message in `printf` format. Combine with `args` to get the | |
58 final message. | |
59 | |
60 `args` | |
61 : Array of extra arguments, corresponding to `printf`-style `%s` | |
62 formatting in the `message`. |