logs

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLogEntry

type AccessLogEntry struct {
	Method       string  `json:"method"`        // HTTP method (GET, POST, etc.)
	Path         string  `json:"path"`          // Request path
	StatusCode   int     `json:"status_code"`   // HTTP status code
	Duration     float64 `json:"duration_ms"`   // Response time in milliseconds
	BytesOut     int64   `json:"bytes_out"`     // Response size
	ClientIP     string  `json:"client_ip"`     // Client IP address
	UserAgent    string  `json:"user_agent"`    // User agent string
	Referrer     string  `json:"referrer"`      // HTTP referrer
	Host         string  `json:"host"`          // Request host/domain
	Protocol     string  `json:"protocol"`      // HTTP/HTTPS
	RouterName   string  `json:"router_name"`   // Traefik router name
	ServiceName  string  `json:"service_name"`  // Traefik service name
	DownstreamIP string  `json:"downstream_ip"` // Original client IP (behind proxy)
}

AccessLogEntry represents Traefik access log details

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector handles log collection from services

func NewCollector

func NewCollector(client *ssh.Client, server string) *Collector

NewCollector creates a new log collector

func (*Collector) GetAccessLogs

func (c *Collector) GetAccessLogs(project string, lines int) ([]*LogEntry, error)

GetAccessLogs fetches recent access logs for a project

func (*Collector) GetContainerLogs

func (c *Collector) GetContainerLogs(project, service string, lines int) ([]*LogEntry, error)

GetContainerLogs fetches recent container logs for a service

func (*Collector) StreamContainerLogs

func (c *Collector) StreamContainerLogs(project, service string, callback func(*LogEntry)) error

StreamContainerLogs streams container logs in real-time

type LogEntry

type LogEntry struct {
	Timestamp   time.Time         `json:"timestamp"`
	Source      string            `json:"source"`     // "container" or "access"
	Project     string            `json:"project"`    // Project name
	Service     string            `json:"service"`    // Service name
	Server      string            `json:"server"`     // Server name
	Message     string            `json:"message"`    // Raw log message (for container logs)
	Level       string            `json:"level"`      // Log level (INFO, ERROR, etc.)
	AccessLog   *AccessLogEntry   `json:"access_log"` // Access log details (if source=access)
	ContainerID string            `json:"container_id"`
	Tags        map[string]string `json:"tags"` // Additional metadata
}

LogEntry represents a unified log entry (container or access log)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL