Annotate

mod_log_json/README.markdown @ 3735:06b640473cda

mod_log_json: Add a README
author Kim Alvefur <zash@zash.se>
date Sun, 03 Nov 2019 14:45:23 +0100
child 3736:3784bbcbb8ff
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
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24 ``` {.json}
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25 {"message":"Client connected","source":"c2s55f267f5b9d0","datetime":"2019-11-03T13:38:28Z","level":"info","args":[]}
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26 {"message":"load_roster: asked for: %s","source":"rostermanager","datetime":"2019-11-03T13:38:28Z","level":"debug","args":["user@example.net"]}
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 ```
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 `datetime`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 : [XEP-0082]-formatted timestamp.
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32 `source`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
33 : Log source, usually a module or a connected session.
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
34
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
35 `level`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
36 : `debug`, `info`, `warn` or `error`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
37
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
38 `message`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
39 : 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
40 final message.
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
41
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
42 `args`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
43 : Array of extra arguments, corresponding to `printf`-style `%s`
06b640473cda mod_log_json: Add a README
Kim Alvefur <zash@zash.se>
parents:
diff changeset
44 formatting in the `message`.