mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Use a more standard date format
This commit is contained in:
parent
de67f9b13f
commit
b6c083c8bb
1 changed files with 6 additions and 3 deletions
|
|
@ -108,8 +108,6 @@ function syslog.sendMessage(settings, notif, severity)
|
|||
local facility = 14 -- log alert
|
||||
local level = 1 -- alert (what about mapping severity?)
|
||||
local prio = (facility * 8) + level
|
||||
local date = format_utils.formatEpoch() -- "2020-11-09 18:00:00"
|
||||
local iso_time = format_utils.formatEpochISO8601() -- ""
|
||||
local host_info = ntop.getHostInformation()
|
||||
local host = host_info.ip
|
||||
local tag = "ntopng"
|
||||
|
|
@ -117,17 +115,22 @@ function syslog.sendMessage(settings, notif, severity)
|
|||
local pid = info.pid
|
||||
|
||||
if syslog_format and syslog_format == "plaintextrfc" then
|
||||
local iso_time = format_utils.formatEpochISO8601() -- "2020-11-19T18:31:21.003Z"
|
||||
|
||||
-- RFC5424 Format:
|
||||
-- <PRIO>VERSION ISOTIMESTAMP HOSTNAME APPLICATION PID MESSAGEID MSG
|
||||
-- Example:
|
||||
-- <113>1 2020-11-19T18:31:21.003Z 192.168.1.1 ntopng 21365 ID1 -
|
||||
msg = "<"..prio..">1 "..iso_time.." "..host.." "..tag.." "..pid.." - - "..msg
|
||||
else
|
||||
-- local log_time = format_utils.formatEpoch() -- "2020-11-09 18:00:00"
|
||||
local log_time = os.date("!%b %d %X") -- "Feb 25 09:58:12"
|
||||
|
||||
-- Unix Format:
|
||||
-- <PRIO>DATE TIME DEVICE APPLICATION[PID]: MSG
|
||||
-- Example:
|
||||
-- <113>09/11/2020 18:31:21 192.168.1.1 ntopng[21365]: ...
|
||||
msg = "<"..prio..">"..date.." "..host.." "..tag.."["..pid.."]: "..msg
|
||||
msg = "<"..prio..">"..log_time.." "..host.." "..tag.."["..pid.."]: "..msg
|
||||
end
|
||||
|
||||
if settings.protocol == 'tcp' then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue