logger

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.1.0

type Config struct {
	CacheSize int
	CacheTTL  time.Duration
}

Config holds configuration settings for session cache.

type HTTPRequest

type HTTPRequest struct {
	Body                string            `json:"body"`
	BodySha256          string            `json:"bodySha256"`
	Headers             map[string]string `json:"headers"`
	HeadersSorted       string            `json:"headersSorted"`
	HeadersSortedSha256 string            `json:"headersSortedSha256"`
	Method              string            `json:"method"`
	ProtocolVersion     string            `json:"protocolVersion"`
	Request             string            `json:"request"`
	SessionID           string            `json:"sessionID"`
	UserAgent           string            `json:"userAgent"`
}

HTTPRequest contains information about the HTTP request.

type LLMInfo added in v1.1.0

type LLMInfo struct {
	Model       string  `json:"model,omitempty"`
	Provider    string  `json:"provider,omitempty"`
	Temperature float64 `json:"temperature,omitempty"`
}

LLMInfo holds information about the large language model

type Logger

type Logger struct {
	EnrichCache *enrich.Enricher
	Sessionizer *Sessionizer
	EventLogger *cblog.Logger
	EventFile   *os.File
	LLMConfig   llm.Config
	Logger      *cblog.Logger
}

Logger contains the components for logging.

func New

func New(eventLogFile string, modelConfig llm.Config, eCache *enrich.Enricher, sessionizer *Sessionizer, l *cblog.Logger) (*Logger, error)

New creates a new Logger instance with the specified configuration.

func (*Logger) LogError

func (l *Logger) LogError(r *http.Request, resp, port string, err error)

LogError logs a failedResponse event.

func (*Logger) LogEvent

func (l *Logger) LogEvent(r *http.Request, resp llm.JSONResponse, port, respSource string, suricataMatches []suricata.Rule)

LogEvent logs a successfulResponse event, including any matched Suricata rules.

type ResponseMetadata added in v1.1.0

type ResponseMetadata struct {
	GenerationSource string  `json:"generationSource"`
	Info             LLMInfo `json:"info,omitempty"`
}

ResponseMetadata holds metadata about the generated response

type Sessionizer added in v1.1.0

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

Sessionizer represents the session cache implementation.

func NewSessionizer added in v1.1.0

func NewSessionizer(cfg Config) *Sessionizer

New creates a new Sessionizer instance with the specified configuration.

func (*Sessionizer) Process added in v1.1.0

func (s *Sessionizer) Process(ip string, t time.Time) (string, error)

Process generates a session ID for the given IP and stores the result in the session cache.

Jump to

Keyboard shortcuts

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