logranger/plugins/action.go
Winni Neessen b6f6b6a664
Implement Actions interface and update rule handling in Server
Introduced an Actions interface for plugins in 'action.go' and implemented a corresponding registry in 'registry.go'. Additionally, adjusted rule related behavior in 'Server' to account for actions, with relevant new fields in Ruleset and Rule. This enables multiple actions on a log message based on defined rules and further modularises the codebase, paving the path for addition of more plugin actions.
2023-12-23 20:29:38 +01:00

18 lines
538 B
Go

// SPDX-FileCopyrightText: 2023 Winni Neessen <wn@neessen.dev>
//
// SPDX-License-Identifier: MIT
package plugins
import (
"github.com/wneessen/go-parsesyslog"
)
// Action is an interface that defines the behavior of an action to be performed
// on a log message.
//
// The Process method takes a log message, a slice of match groups, and a
// configuration map, and returns an error if any occurs during processing.
type Action interface {
Process(logmessage parsesyslog.LogMsg, matchgroup []string, confmap map[string]any) error
}