comparison mod_audit/mod_audit.lua @ 5317:0091b7de2763

mod_audit: Allow caller to specify time of the event
author Matthew Wild <mwild1@gmail.com>
date Fri, 07 Apr 2023 12:00:06 +0100
parents e3a3a6c86a9f
children c5ecfb06afde
comparison
equal deleted inserted replaced
5316:4fc3277a914d 5317:0091b7de2763
109 stanza:add_child(child); 109 stanza:add_child(child);
110 end 110 end
111 end 111 end
112 end 112 end
113 113
114 local id, err = stores[host]:append(nil, nil, stanza, time_now(), user_key); 114 local id, err = stores[host]:append(nil, nil, stanza, extra and extra.timestamp or time_now(), user_key);
115 if err then 115 if err then
116 module:log("error", "failed to persist audit event: %s", err); 116 module:log("error", "failed to persist audit event: %s", err);
117 return 117 return
118 else 118 else
119 module:log("debug", "persisted audit event %s as %s", stanza:top_tag(), id); 119 module:log("debug", "persisted audit event %s as %s", stanza:top_tag(), id);