package main import ( "time" ) type SystemResources struct { Timestamp time.Time `json:"@timestamp"` Type string `json:"type"` Host string `json:"host"` CPUPercent float64 `json:"cpu_percent,omitempty"` MemoryUsed uint64 `json:"memory_used,omitempty"` MemoryTotal uint64 `json:"memory_total,omitempty"` MemoryPercent float64 `json:"memory_percent,omitempty"` DiskUsage map[string]DiskUsage `json:"disk_usage,omitempty"` NetworkStats map[string]NetworkStat `json:"network_stats,omitempty"` LoadAverage []float64 `json:"load_average,omitempty"` Uptime uint64 `json:"uptime,omitempty"` TopProcesses []ProcessInfo `json:"top_processes"` OpenFileDescriptors int32 `json:"open_file_descriptors"` DiskIOStats map[string]DiskIOStat `json:"disk_io_stats,omitempty"` NetworkLatency map[string]LatencyInfo `json:"network_latency,omitempty"` BandwidthUtilization map[string]BandwidthInfo `json:"bandwidth_utilization,omitempty"` NetworkConnections ConnectionStats `json:"network_connections"` TCPStats TCPStatistics `json:"tcp_stats"` SystemLimits SystemLimitInfo `json:"system_limits"` } type DiskIOStat struct { ReadBytes uint64 `json:"read_bytes"` WriteBytes uint64 `json:"write_bytes"` ReadOps uint64 `json:"read_ops"` WriteOps uint64 `json:"write_ops"` ReadTime uint64 `json:"read_time"` WriteTime uint64 `json:"write_time"` IOUtilization float64 `json:"io_utilization"` AvgReadLatency float64 `json:"avg_read_latency"` AvgWriteLatency float64 `json:"avg_write_latency"` } type LatencyInfo struct { Host string `json:"host"` MinLatency time.Duration `json:"min_latency"` MaxLatency time.Duration `json:"max_latency"` AvgLatency time.Duration `json:"avg_latency"` PacketLoss float64 `json:"packet_loss"` Jitter time.Duration `json:"jitter"` } type BandwidthInfo struct { Interface string `json:"interface"` CurrentThroughputIn float64 `json:"current_throughput_in_mbps"` CurrentThroughputOut float64 `json:"current_throughput_out_mbps"` PeakThroughputIn float64 `json:"peak_throughput_in_mbps"` PeakThroughputOut float64 `json:"peak_throughput_out_mbps"` UtilizationPercent float64 `json:"utilization_percent"` } type ConnectionStats struct { TotalConnections int32 `json:"total_connections"` EstablishedTCP int32 `json:"established_tcp"` ListeningTCP int32 `json:"listening_tcp"` TimeWaitTCP int32 `json:"time_wait_tcp"` TransferConnections int32 `json:"transfer_connections"` ConnectionsByState map[string]int32 `json:"connections_by_state"` } type LoadAverageInfo struct { Load1 float64 `json:"load_1min"` Load5 float64 `json:"load_5min"` Load15 float64 `json:"load_15min"` } type TCPStatistics struct { RetransmitRate float64 `json:"retransmit_rate"` OutOfOrderPackets uint64 `json:"out_of_order_packets"` LostPackets uint64 `json:"lost_packets"` CongestionWindow uint64 `json:"congestion_window"` TCPMemoryUsage uint64 `json:"tcp_memory_usage"` } type SystemLimitInfo struct { MaxOpenFiles uint64 `json:"max_open_files"` CurrentOpenFiles uint64 `json:"current_open_files"` MaxProcesses uint64 `json:"max_processes"` CurrentProcesses uint64 `json:"current_processes"` MaxTCPConnections uint64 `json:"max_tcp_connections"` CurrentTCPConnections uint64 `json:"current_tcp_connections"` FileDescriptorUsage float64 `json:"file_descriptor_usage_percent"` } type DiskUsage struct { Used uint64 `json:"used"` Total uint64 `json:"total"` UsedPercent float64 `json:"used_percent"` Free uint64 `json:"free"` } type ProcessInfo struct { PID int32 `json:"pid"` Name string `json:"name"` CPUPercent float64 `json:"cpu_percent"` MemoryMB float32 `json:"memory_mb"` Status string `json:"status"` CreateTime int64 `json:"create_time"` } type NetworkStat struct { BytesSent uint64 `json:"bytes_sent"` BytesRecv uint64 `json:"bytes_recv"` PacketsSent uint64 `json:"packets_sent"` PacketsRecv uint64 `json:"packets_recv"` } type LogEntry struct { Service string `json:"service,omitempty"` Timestamp time.Time `json:"timestamp"` Type string `json:"type"` Host string `json:"host"` Tool string `json:"tool,omitempty"` LogLevel string `json:"log_level"` LogMessage string `json:"message,omitempty"` SyslogInfo SyslogFields `json:"syslog_information,omitempty"` BaseInformation any `json:"base_info"` ServiceInformation any `json:"service_info"` SystemMetrics SystemResources `json:"system-metrics"` ToolInformation any `json:"tool_info"` Raw string `json:"raw,omitempty"` Priority string `json:"priority,omitempty"` PriorityName string `json:"priority_name,omitempty"` Unit string `json:"unit,omitempty"` PID int `json:"pid,omitempty"` BootID string `json:"boot_id,omitempty"` MachineID string `json:"machine_id,omitempty"` Fields map[string]any `json:"fields,omitempty"` } type LogMessage struct { Service string `json:"service"` Timestamp time.Time `json:"timestamp"` LogLevel string `json:"log_level"` LogMessage string `json:"log_message"` SyslogInfo SyslogFields `json:"syslog_information"` BaseInformation any `json:"base_info"` ServiceInformation any `json:"service_info"` SystemMetrics SystemResources `json:"system-metrics"` ToolInformation any `json:"tool_info"` } type SyslogFields struct { SysLogTimestamp time.Time `json:"syslog_timestamp"` Hostname string `json:"hostname"` ProcessInfo string `json:"process_info"` Raw string `json:"raw,omitempty"` Priority string `json:"priority,omitempty"` Unit string `json:"unit,omitempty"` PID int `json:"pid,omitempty"` BootID string `json:"boot_id,omitempty"` MachineID string `json:"machine_id,omitempty"` Fields map[string]any `json:"fields"` } func NewLogEntry(entryType string) LogEntry { return LogEntry{ Timestamp: time.Now(), Type: entryType, Host: hostname, // Fields: make(map[string]any), } } func NewSystemResources() SystemResources { return SystemResources{ Timestamp: time.Now(), Type: "system_metrics", Host: hostname, DiskUsage: make(map[string]DiskUsage), DiskIOStats: make(map[string]DiskIOStat), NetworkStats: make(map[string]NetworkStat), NetworkLatency: make(map[string]LatencyInfo), BandwidthUtilization: make(map[string]BandwidthInfo), } } type AMBaseInfo struct { ProcessID string `json:"process_id"` ThreadID string `json:"thread_id"` LoggerName string `json:"logger_name"` } type TCCBaseInfo struct { ProcessID string `json:"process_id"` ThreadID string `json:"thread_id"` LoggerName string `json:"logger_name"` } type NGinXBaseInfo struct { ClientIP string `json:"client_ip"` RemoteUser string `json:"remote_user"` Request string `json:"request"` StatusCode int `json:"status_code"` BytesSend int `json:"bytes_sent"` Referer string `json:"referer"` UserAgent string `json:"user_agent"` HTTPMethod string `json:"http_method"` RequestURI string `json:"request_uri"` HTTPVersion string `json:"http_version"` Route string `json:"route"` } type TSBaseInfo struct { TransferID string `json:"transfer_identifier"` Lane int `json:"thread"` Direction string `json:"direction"` Buffers int `json:"buffers"` FileCount int `json:"file_count"` FileSize float64 `json:"file_size"` ChunkSize int `json:"chunksize"` Streams int `json:"streams"` TargetDatarate float64 `json:"target_datarate"` Protocoll string `json:"protocoll"` Destination string `json:"destination"` Sender string `json:"sender_id"` Target string `json:"transfer_target"` Source string `json:"source"` Receiver string `json:"receiver_id"` StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` } type TSTransferInfo struct { TransferID string `json:"transfer_identifier"` StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` TransferLane string `json:"transfer_lane"` FileCount int `json:"file_count"` FileSizeMB float64 `json:"file_size_mb"` DataRateMBs float64 `json:"datarate_mbs"` Dest string `json:"destination"` Src string `json:"source"` SenderID string `json:"sender_id"` Receiver string `json:"receiver"` BytesProcessed int64 `json:"bytes_processed"` Direction string `json:"direction"` Duration time.Duration `json:"duration_seconds"` TheoreticalRate float64 `json:"theoretical_rate_mbs"` Efficiency float64 `json:"efficiency_percent"` Status string `json:"status"` } type TJMBaseInfo struct { ProcessID string `json:"process_id"` TransferID string `json:"transfer_identifier"` Direction string `json:"direction"` Username string `json:"username"` CorrelationID string `json:"correlation_id"` ThreadID string `json:"thread_id"` JavaClass string `json:"java_class"` } type TJMTransferInfo struct { TransferID string `json:"transfer_identifier"` TransferName string `json:"transfer_name"` StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` TransferLane string `json:"transfer_lane"` Dest string `json:"destination"` Src string `json:"source"` SenderID string `json:"sender_id"` Receiver string `json:"receiver"` Direction string `json:"direction"` Worker string `json:"worker"` Duration time.Duration `json:"duration"` DataRateMBs float64 `json:"datarate_mbs"` BytesProcessed int64 `json:"bytes_processed"` FileSizeMB float64 `json:"file_size_mb"` }