logs

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 14 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 AggregatedLog added in v0.0.3

type AggregatedLog struct {
	Timestamp time.Time         `json:"timestamp"`
	Level     LogLevel          `json:"level"`
	Service   string            `json:"service"`
	Server    string            `json:"server"`
	Container string            `json:"container,omitempty"`
	Message   string            `json:"message"`
	Source    string            `json:"source"` // "container", "access", "system"
	Metadata  map[string]string `json:"metadata,omitempty"`
}

AggregatedLog represents a log entry from any source

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 LogAggregator added in v0.0.3

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

LogAggregator collects and aggregates logs from multiple sources

func NewLogAggregator added in v0.0.3

func NewLogAggregator(cfg *config.Config, sshPool *ssh.Pool, environment string, verbose bool) *LogAggregator

NewLogAggregator creates a new log aggregator

func (*LogAggregator) Export added in v0.0.3

func (a *LogAggregator) Export(logs []AggregatedLog, format, outputPath string) error

Export exports logs to a file

func (*LogAggregator) Query added in v0.0.3

func (a *LogAggregator) Query(ctx context.Context, query LogQuery) ([]AggregatedLog, error)

Query searches logs based on criteria

func (*LogAggregator) Stream added in v0.0.3

func (a *LogAggregator) Stream(ctx context.Context, query LogQuery) (<-chan AggregatedLog, error)

Stream starts streaming logs to a channel

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)

type LogLevel added in v0.0.3

type LogLevel string

LogLevel represents log severity

const (
	LevelDebug LogLevel = "DEBUG"
	LevelInfo  LogLevel = "INFO"
	LevelWarn  LogLevel = "WARN"
	LevelError LogLevel = "ERROR"
	LevelFatal LogLevel = "FATAL"
)

type LogQuery added in v0.0.3

type LogQuery struct {
	Services []string
	Servers  []string
	Levels   []LogLevel
	Since    time.Time
	Until    time.Time
	Contains string
	Regex    string
	Limit    int
}

LogQuery defines search/filter criteria

Jump to

Keyboard shortcuts

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