Mercurial > prosody-modules
annotate mod_log_json/README.markdown @ 3742:05bca7a771d6
mod_bookmarks2: Remove unused variables.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 13 Nov 2019 16:45:48 +0100 |
parents | 3784bbcbb8ff |
children | e43a82ddde12 |
rev | line source |
---|---|
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 | |
3736
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
24 Example (with whitespace and indentation for readability): |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
25 |
3735 | 26 ``` {.json} |
3736
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
27 { |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
28 "args" : [], |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
29 "datetime" : "2019-11-03T13:38:28Z", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
30 "level" : "info", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
31 "message" : "Client connected", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
32 "source" : "c2s55f267f5b9d0" |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
33 } |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
34 { |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
35 "args" : [ |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
36 "user@example.net" |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
37 ], |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
38 "datetime" : "2019-11-03T13:38:28Z", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
39 "level" : "debug", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
40 "message" : "load_roster: asked for: %s", |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
41 "source" : "rostermanager" |
3784bbcbb8ff
mod_log_json: Prettify JSON for readability
Kim Alvefur <zash@zash.se>
parents:
3735
diff
changeset
|
42 } |
3735 | 43 ``` |
44 | |
45 `datetime` | |
46 : [XEP-0082]-formatted timestamp. | |
47 | |
48 `source` | |
49 : Log source, usually a module or a connected session. | |
50 | |
51 `level` | |
52 : `debug`, `info`, `warn` or `error` | |
53 | |
54 `message` | |
55 : The log message in `printf` format. Combine with `args` to get the | |
56 final message. | |
57 | |
58 `args` | |
59 : Array of extra arguments, corresponding to `printf`-style `%s` | |
60 formatting in the `message`. |