diff options
author | Kim Alvefur <zash@zash.se> | 2021-07-14 02:41:15 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-07-14 02:41:15 +0200 |
commit | 9298e3ba8aafcf415f126240ebf0795975cb0b8f (patch) | |
tree | f8fde447a8204d2e0b5c85b80ec4adeddef4040d /plugins/mod_s2s.lua | |
parent | bfa8e5b52a048ba6dd60f5aa54df14d1ee60392e (diff) | |
download | prosody-9298e3ba8aafcf415f126240ebf0795975cb0b8f.tar.gz prosody-9298e3ba8aafcf415f126240ebf0795975cb0b8f.zip |
mod_s2s: Vary log level by remote stream error
Increases log level for stream conditions that could indicate a problem
on our end, especially programming errors like invalid XML, or the
remote server saying that our certificate is invalid, since these should
be investigated.
Non-issues like closing of idle streams are lowered to debug since it's
mostly noise.
Other issues left at info are mostly about changes to the remote server,
e.g. complete or partial shutdown.
Diffstat (limited to 'plugins/mod_s2s.lua')
-rw-r--r-- | plugins/mod_s2s.lua | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua index f673e9c5..f2a7c850 100644 --- a/plugins/mod_s2s.lua +++ b/plugins/mod_s2s.lua @@ -526,6 +526,38 @@ function stream_callbacks.streamclosed(session, attr) session.thread:run({ stream = "closed", attr = attr }); end +-- Some stream conditions indicate a problem on our end, e.g. that we sent +-- something invalid. Those should be investigated. Others are problems or +-- events in the remote host that don't affect us, or simply that the +-- connection was closed for being idle. +local stream_condition_severity = { + ["bad-format"] = "warn"; + ["bad-namespace-prefix"] = "warn"; + ["conflict"] = "warn"; + ["connection-timeout"] = "debug"; + ["host-gone"] = "info"; + ["host-unknown"] = "info"; + ["improper-addressing"] = "warn"; + ["internal-server-error"] = "warn"; + ["invalid-from"] = "warn"; + ["invalid-namespace"] = "warn"; + ["invalid-xml"] = "warn"; + ["not-authorized"] = "warn"; + ["not-well-formed"] = "warn"; + ["policy-violation"] = "warn"; + ["remote-connection-failed"] = "warn"; + ["reset"] = "info"; + ["resource-constraint"] = "info"; + ["restricted-xml"] = "warn"; + ["see-other-host"] = "info"; + ["system-shutdown"] = "info"; + ["undefined-condition"] = "warn"; + ["unsupported-encoding"] = "warn"; + ["unsupported-feature"] = "warn"; + ["unsupported-stanza-type"] = "warn"; + ["unsupported-version"] = "warn"; +} + function stream_callbacks.error(session, error, data) if error == "no-stream" then session.log("debug", "Invalid opening stream header (%s)", (data:gsub("^([^\1]+)\1", "{%1}"))); @@ -546,7 +578,7 @@ function stream_callbacks.error(session, error, data) end end text = condition .. (text and (" ("..text..")") or ""); - session.log("info", "Session closed by remote with error: %s", text); + session.log(stream_condition_severity[condition] or "info", "Session closed by remote with error: %s", text); session:close(nil, text); end end |