feat(api): add timestamp field to LogRecord
- Add Timestamp field (int64, nanoseconds since Unix epoch) to LogRecord - Import time package in api/types.go - Set timestamp using time.Now().UnixNano() in NewLogRecord() - Add test assertion to verify timestamp is set The timestamp is now included in all JSON log outputs Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package api
|
||||
|
||||
import "time"
|
||||
|
||||
// ServiceLog represents internal service logging for diagnostics
|
||||
type ServiceLog struct {
|
||||
Level string `json:"level"`
|
||||
@ -85,6 +87,9 @@ type LogRecord struct {
|
||||
JA4Hash string `json:"ja4_hash"`
|
||||
JA3 string `json:"ja3,omitempty"`
|
||||
JA3Hash string `json:"ja3_hash,omitempty"`
|
||||
|
||||
// Timestamp in nanoseconds since Unix epoch
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// OutputConfig defines configuration for a single log output
|
||||
@ -212,6 +217,7 @@ func NewLogRecord(ch TLSClientHello, fp *Fingerprints) LogRecord {
|
||||
TCPMSS: mssPtr,
|
||||
TCPWScale: wScalePtr,
|
||||
TCPOptions: opts,
|
||||
Timestamp: time.Now().UnixNano(),
|
||||
}
|
||||
|
||||
if fp != nil {
|
||||
|
||||
Reference in New Issue
Block a user