Software /
code /
prosody-modules
Comparison
mod_audit/mod_audit.lua @ 5322:eb832553d635
mod_audit: Use proportional columns in table output
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 07 Apr 2023 13:09:51 +0100 |
parent | 5321:d02f465e2aff |
child | 5323:400ffa842576 |
comparison
equal
deleted
inserted
replaced
5321:d02f465e2aff | 5322:eb832553d635 |
---|---|
149 return 1; | 149 return 1; |
150 end | 150 end |
151 | 151 |
152 local colspec = { | 152 local colspec = { |
153 { title = "Date", key = "when", width = 19, mapper = function (when) return os.date("%Y-%m-%d %R:%S", when); end }; | 153 { title = "Date", key = "when", width = 19, mapper = function (when) return os.date("%Y-%m-%d %R:%S", when); end }; |
154 { title = "Source", key = "source", width = 18 }; | 154 { title = "Source", key = "source", width = "2p" }; |
155 { title = "Event", key = "event_type", width = 22 }; | 155 { title = "Event", key = "event_type", width = "2p" }; |
156 }; | 156 }; |
157 | 157 |
158 if not arg.global then | 158 if not arg.global then |
159 table.insert(colspec, { | 159 table.insert(colspec, { |
160 title = "User", key = "username", width = 30, | 160 title = "User", key = "username", width = "2p", |
161 mapper = function (user) | 161 mapper = function (user) |
162 if user == "@" then return ""; end | 162 if user == "@" then return ""; end |
163 if user:sub(-#host-1, -1) == ("@"..host) then | 163 if user:sub(-#host-1, -1) == ("@"..host) then |
164 return (user:gsub("@.+$", "")); | 164 return (user:gsub("@.+$", "")); |
165 end | 165 end |
166 end; | 166 end; |
167 }); | 167 }); |
168 | 168 |
169 if attach_ips then | 169 if attach_ips then |
170 table.insert(colspec, { | 170 table.insert(colspec, { |
171 title = "IP", key = "ip", width = "28"; | 171 title = "IP", key = "ip", width = "2p"; |
172 }); | 172 }); |
173 end | 173 end |
174 if attach_location then | 174 if attach_location then |
175 table.insert(colspec, { | 175 table.insert(colspec, { |
176 title = "Location", key = "country", width = 2; | 176 title = "Location", key = "country", width = 2; |