cmd

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	File   os.File
	Writer *bufio.Writer

	Version = "1.4.5"

	BuildInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "postfixlogparser_build_info",
		Help: "Constant 1 value labeled by version and goversion from which postfix-log-parser was built",
	}, []string{"version", "goversion"})
	StartTime = promauto.NewGauge(prometheus.GaugeOpts{
		Name: "postfixlogparser_time_start_seconds",
		Help: "Process start time in UNIX timestamp (seconds)",
	})
	LineReadCnt = promauto.NewCounter(prometheus.CounterOpts{
		Name: "postfixlogparser_line_read_count",
		Help: "Number of lines read",
	})
	LineIncorrectCnt = promauto.NewCounter(prometheus.CounterOpts{
		Name: "postfixlogparser_line_incorrect_count",
		Help: "Number of lines with incorrect format",
	})
	LineOutCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "postfixlogparser_line_out_count",
		Help: "Number of lines written to ouput",
	}, []string{"host"})
	MsgInCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "postfixlogparser_msg_in_count",
		Help: "Number of mails accepted by smtpd",
	}, []string{"host"})
	MsgSentCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "postfixlogparser_msg_sent_count",
		Help: "Number of mails sent",
	}, []string{"host"})
	MsgDeferredCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "postfixlogparser_msg_deferred_count",
		Help: "Number of mails deferred",
	}, []string{"host"})
	MsgBouncedCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "postfixlogparser_msg_bounced_count",
		Help: "Number of mails bounced",
	}, []string{"host"})
	MsgRejectedCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "postfixlogparser_msg_rejected_count",
		Help: "Number of mails rejected",
	}, []string{"host"})
	MsgHoldCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "postfixlogparser_msg_hold_count",
		Help: "Number of mails hold",
	}, []string{"host"})
	MsgAuthFailed = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "postfixlogparser_auth_failed_count",
		Help: "Number of failed authentications",
	}, []string{"host"})
	ConnectedClientCnt = promauto.NewGauge(prometheus.GaugeOpts{
		Name: "postfixlogparser_client_count",
		Help: "Number of connected clients",
	})
)

Functions

func Execute

func Execute()

func NewWriter added in v1.1.1

func NewWriter(file string) (*bufio.Writer, *os.File, error)

Types

type Message

type Message struct {
	Time     *time.Time `json:"time"`
	To       string     `json:"to"`
	Status   string     `json:"status"`
	Message  string     `json:"message"`
	BounceId string     `json:"bounce_id"`
}

type PostfixLogParser

type PostfixLogParser struct {
	Time           *time.Time `json:"time"`
	Hostname       string     `json:"hostname"`
	Process        string     `json:"process"`
	QueueId        string     `json:"queue_id"`
	ClientHostname string     `json:"client_hostname"`
	ClinetIp       string     `json:"client_ip"`
	SaslMethod     string     `json:"sasl_method"`
	SaslUsername   string     `json:"sasl_username"`
	MessageId      string     `json:"message_id"`
	From           string     `json:"from"`
	Size           string     `json:"size"`
	NRcpt          string     `json:"nrcpt"`
	Messages       []Message  `json:"messages"`
}

type PostfixLogParserFlat added in v1.1.0

type PostfixLogParserFlat struct {
	Time           *time.Time `json:"time"`
	Hostname       string     `json:"hostname"`
	Process        string     `json:"process"`
	QueueId        string     `json:"queue_id"`
	ClientHostname string     `json:"client_hostname"`
	ClinetIp       string     `json:"client_ip"`
	SaslMethod     string     `json:"sasl_method"`
	SaslUsername   string     `json:"sasl_username"`
	MessageId      string     `json:"message_id"`
	From           string     `json:"from"`
	Size           string     `json:"size"`
	NRcpt          string     `json:"nrcpt"`
	TimeSent       *time.Time `json:"time_sent"`
	To             string     `json:"to"`
	Status         string     `json:"status"`
	Message        string     `json:"message"`
	BounceId       string     `json:"bounce_id"`
}

func PlpToFlat added in v1.1.0

func PlpToFlat(plp *PostfixLogParser) []PostfixLogParserFlat

Jump to

Keyboard shortcuts

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