Show server reception time before the message time

- Store a 'received' field (server clock) with every message
- New first column with the reception time
- Settings: time zone (browser, UTC, ~80 zones) and reception time
  format (YYYY-MM-DD - HH:MM:SS:mmm by default, ISO 8601, 12h, epoch...)
- The chosen time zone applies to every date shown

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cedricandClaude Opus 5.5 committed 2026-09-28 14:55:43 +02:00
1 parent 9bb1939a67
commit 85701a9119
5 files changed
+207 -14

No files matched your search

+4 -2
View File
@@ -22,7 +22,8 @@ var facilityNames = [24]string{
// Entry is a decoded syslog message.
type Entry struct {
Time time.Time
Time time.Time // timestamp from the message header (or reception time if absent)
Received time.Time // reception time, from the server clock
Host string
App string
ProcID string
@@ -39,6 +40,7 @@ type Entry struct {
func (e *Entry) Record() map[string]string {
r := map[string]string{
"_time": e.Time.UTC().Format(time.RFC3339Nano),
"received": e.Received.UTC().Format(time.RFC3339Nano),
"_msg": e.Message,
"host": e.Host,
"app": e.App,
@@ -70,7 +72,7 @@ func ParseSyslog(raw []byte, source, proto string, now time.Time) *Entry {
if !utf8.ValidString(s) {
s = strings.ToValidUTF8(s, "\uFFFD")
}
e := &Entry{Time: now, Host: source, Source: source, Proto: proto}
e := &Entry{Time: now, Received: now, Host: source, Source: source, Proto: proto}
e.setPri(13) // user.notice, the RFC 3164 default
if len(s) > 2 && s[0] == '<' {