diff mod_log_json/README.markdown @ 4462:4356088ad675

mod_log_json: allow logging of formatted message This is for logging pipelines which can not or do not want to interpret sprintf-style strings but still need the complete string for search or whatever.
author Jonas Schäfer <jonas@wielicki.name>
date Mon, 22 Feb 2021 16:08:55 +0100
parents bc865568ff02
children
line wrap: on
line diff
--- a/mod_log_json/README.markdown	Mon Feb 22 17:56:27 2021 +0100
+++ b/mod_log_json/README.markdown	Mon Feb 22 16:08:55 2021 +0100
@@ -70,3 +70,22 @@
 `args`
 :   Array of extra arguments, corresponding to `printf`-style `%s`
     formatting in the `message`.
+
+Formatted message
+-----------------
+
+If desired, at the obvious expense of performance, the formatted version of
+the string can be included in the JSON object by specifying the `formatted_as`
+key in the logger config:
+
+``` {.lua}
+log = {
+  -- ... other sinks ...
+  { to = "json", formatted_as = "msg_formatted", filename = "/var/log/prosody/prosody.json" };
+}
+
+```
+
+This will expose the formatted message in the JSON as separate `msg_formatted`
+key. It is possible to override existing keys using this (for example, the
+`message` key), but not advisible.