annotate mod_log_json/README.markdown @ 3736:3784bbcbb8ff

mod_log_json: Prettify JSON for readability
author Kim Alvefur <zash@zash.se>
date Sun, 03 Nov 2019 14:47:00 +0100
parents 06b640473cda
children e43a82ddde12
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3735
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 ---
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2 summary: JSON Log Sink
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 ---
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 Conifiguration
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 ==============
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 ``` {.lua}
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 log = {
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 -- your other log sinks
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 info = "/var/log/prosody/prosody.log"
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 -- add this:
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 { to = "json", filename = "/var/log/prosody/prosody.json" };
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 }
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 ```
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17 Format
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 ======
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 JSON log files consist of a series of `\n`-separated JSON objects,
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 suitable for mangling with tools like
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 [`jq`](https://stedolan.github.io/jq/).
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
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
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
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
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
43 ```
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
44
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
45 `datetime`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
46 : [XEP-0082]-formatted timestamp.
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
47
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
48 `source`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
49 : Log source, usually a module or a connected session.
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
50
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
51 `level`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
52 : `debug`, `info`, `warn` or `error`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
53
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
54 `message`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
55 : The log message in `printf` format. Combine with `args` to get the
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
56 final message.
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
57
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
58 `args`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
59 : Array of extra arguments, corresponding to `printf`-style `%s`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
60 formatting in the `message`.