loggers

package
v0.30.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPriority

func GetPriority(facility string) (syslog.Priority, error)

func IsValidMode added in v0.26.0

func IsValidMode(mode string) bool

func SanitizeMetricName added in v0.22.0

func SanitizeMetricName(metricName string) string

OpenMetrics and the Prometheus exposition format require the metric name to consist only of alphanumericals and "_", ":" and they must not start with digits.

Types

type DnstapSender

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

func NewDnstapSender

func NewDnstapSender(config *dnsutils.Config, logger *logger.Logger, name string) *DnstapSender

func (*DnstapSender) Channel

func (o *DnstapSender) Channel() chan dnsutils.DnsMessage

func (*DnstapSender) GetName added in v0.22.0

func (c *DnstapSender) GetName() string

func (*DnstapSender) LogError

func (o *DnstapSender) LogError(msg string, v ...interface{})

func (*DnstapSender) LogInfo

func (o *DnstapSender) LogInfo(msg string, v ...interface{})

func (*DnstapSender) ReadConfig

func (o *DnstapSender) ReadConfig()

func (*DnstapSender) Run

func (o *DnstapSender) Run()

func (*DnstapSender) SetLoggers added in v0.22.0

func (c *DnstapSender) SetLoggers(loggers []dnsutils.Worker)

func (*DnstapSender) Stop

func (o *DnstapSender) Stop()

type ElasticSearchClient added in v0.23.0

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

func NewElasticSearchClient added in v0.23.0

func NewElasticSearchClient(config *dnsutils.Config, console *logger.Logger, name string) *ElasticSearchClient

func (*ElasticSearchClient) Channel added in v0.23.0

func (o *ElasticSearchClient) Channel() chan dnsutils.DnsMessage

func (*ElasticSearchClient) GetName added in v0.23.0

func (c *ElasticSearchClient) GetName() string

func (*ElasticSearchClient) LogError added in v0.23.0

func (o *ElasticSearchClient) LogError(msg string, v ...interface{})

func (*ElasticSearchClient) LogInfo added in v0.23.0

func (o *ElasticSearchClient) LogInfo(msg string, v ...interface{})

func (*ElasticSearchClient) ReadConfig added in v0.23.0

func (c *ElasticSearchClient) ReadConfig()

func (*ElasticSearchClient) Run added in v0.23.0

func (o *ElasticSearchClient) Run()

func (*ElasticSearchClient) SetLoggers added in v0.23.0

func (c *ElasticSearchClient) SetLoggers(loggers []dnsutils.Worker)

func (*ElasticSearchClient) Stop added in v0.23.0

func (o *ElasticSearchClient) Stop()

type ElasticSearchData added in v0.23.0

type ElasticSearchData struct {
	Identity  string `json:"identity"`
	QueryIP   string `json:"query_ip"`
	QName     string `json:"q_name"`
	Operation string `json:"operation"`
	Family    string `json:"family"`
	Protocol  string `json:"protocol"`
	QType     string `json:"q_type"`
	RCode     string `json:"r_code"`
	TimeStamp int64  `json:"timestamp"`
}

type EpsCounters added in v0.22.0

type EpsCounters struct {
	Eps             uint64
	EpsMax          uint64
	TotalEvents     uint64
	TotalEventsPrev uint64
}

type FakeLogger

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

func NewFakeLogger

func NewFakeLogger() *FakeLogger

func (*FakeLogger) Channel

func (o *FakeLogger) Channel() chan dnsutils.DnsMessage

func (*FakeLogger) GetName added in v0.22.0

func (c *FakeLogger) GetName() string

func (*FakeLogger) ReadConfig added in v0.16.0

func (o *FakeLogger) ReadConfig()

func (*FakeLogger) Run

func (o *FakeLogger) Run()

func (*FakeLogger) SetLoggers added in v0.22.0

func (c *FakeLogger) SetLoggers(loggers []dnsutils.Worker)

func (*FakeLogger) Stop

func (o *FakeLogger) Stop()

type FluentdClient

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

func NewFluentdClient

func NewFluentdClient(config *dnsutils.Config, logger *logger.Logger, name string) *FluentdClient

func (*FluentdClient) Channel

func (o *FluentdClient) Channel() chan dnsutils.DnsMessage

func (*FluentdClient) GetName added in v0.22.0

func (c *FluentdClient) GetName() string

func (*FluentdClient) LogError

func (o *FluentdClient) LogError(msg string, v ...interface{})

func (*FluentdClient) LogInfo

func (o *FluentdClient) LogInfo(msg string, v ...interface{})

func (*FluentdClient) ReadConfig

func (o *FluentdClient) ReadConfig()

func (*FluentdClient) Run

func (o *FluentdClient) Run()

func (*FluentdClient) SetLoggers added in v0.22.0

func (c *FluentdClient) SetLoggers(loggers []dnsutils.Worker)

func (*FluentdClient) Stop

func (o *FluentdClient) Stop()

type HitsRecord added in v0.25.0

type HitsRecord struct {
	TotalHits int            `json:"total-hits"`
	Hits      map[string]int `json:"hits"`
}

type HitsStream added in v0.25.0

type HitsStream struct {
	Streams map[string]SearchBy
}

type HitsUniq added in v0.25.0

type HitsUniq struct {
	Clients        map[string]int
	Domains        map[string]int
	NxDomains      map[string]int
	SfDomains      map[string]int
	PublicSuffixes map[string]int
	Suspicious     map[string]*dnsutils.Suspicious
}

type InfluxDBClient added in v0.13.0

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

func NewInfluxDBClient added in v0.13.0

func NewInfluxDBClient(config *dnsutils.Config, logger *logger.Logger, name string) *InfluxDBClient

func (*InfluxDBClient) Channel added in v0.13.0

func (o *InfluxDBClient) Channel() chan dnsutils.DnsMessage

func (*InfluxDBClient) GetName added in v0.22.0

func (c *InfluxDBClient) GetName() string

func (*InfluxDBClient) LogError added in v0.13.0

func (o *InfluxDBClient) LogError(msg string, v ...interface{})

func (*InfluxDBClient) LogInfo added in v0.13.0

func (o *InfluxDBClient) LogInfo(msg string, v ...interface{})

func (*InfluxDBClient) ReadConfig added in v0.13.0

func (o *InfluxDBClient) ReadConfig()

func (*InfluxDBClient) Run added in v0.13.0

func (o *InfluxDBClient) Run()

func (*InfluxDBClient) SetLoggers added in v0.22.0

func (c *InfluxDBClient) SetLoggers(loggers []dnsutils.Worker)

func (*InfluxDBClient) Stop added in v0.13.0

func (o *InfluxDBClient) Stop()

type LogFile

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

func NewLogFile

func NewLogFile(config *dnsutils.Config, logger *logger.Logger, name string) *LogFile

func (*LogFile) Channel

func (l *LogFile) Channel() chan dnsutils.DnsMessage

func (*LogFile) Cleanup added in v0.5.0

func (l *LogFile) Cleanup() error

func (*LogFile) CompressFile added in v0.26.0

func (l *LogFile) CompressFile()

func (*LogFile) CompressPostRotateCommand added in v0.17.0

func (l *LogFile) CompressPostRotateCommand(filename string)

func (*LogFile) FlushWriters added in v0.26.0

func (l *LogFile) FlushWriters()

func (*LogFile) GetMaxSize added in v0.26.0

func (o *LogFile) GetMaxSize() int64

func (*LogFile) GetName added in v0.22.0

func (l *LogFile) GetName() string

func (*LogFile) LogError added in v0.5.0

func (l *LogFile) LogError(msg string, v ...interface{})

func (*LogFile) LogInfo added in v0.5.0

func (l *LogFile) LogInfo(msg string, v ...interface{})

func (*LogFile) OpenFile

func (l *LogFile) OpenFile() error

func (*LogFile) PostRotateCommand added in v0.5.0

func (l *LogFile) PostRotateCommand(filename string)

func (*LogFile) ReadConfig

func (l *LogFile) ReadConfig()

func (*LogFile) RotateFile added in v0.26.0

func (l *LogFile) RotateFile() error

func (*LogFile) Run

func (l *LogFile) Run()

func (*LogFile) SetLoggers added in v0.22.0

func (l *LogFile) SetLoggers(loggers []dnsutils.Worker)

func (*LogFile) Stop

func (l *LogFile) Stop()

func (*LogFile) WriteToDnstap added in v0.26.0

func (l *LogFile) WriteToDnstap(data []byte)

func (*LogFile) WriteToPcap added in v0.26.0

func (l *LogFile) WriteToPcap(dm dnsutils.DnsMessage, pkt []gopacket.SerializableLayer)

func (*LogFile) WriteToPlain added in v0.26.0

func (l *LogFile) WriteToPlain(data []byte)

type LokiClient added in v0.13.0

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

func NewLokiClient added in v0.13.0

func NewLokiClient(config *dnsutils.Config, logger *logger.Logger, name string) *LokiClient

func (*LokiClient) Channel added in v0.13.0

func (o *LokiClient) Channel() chan dnsutils.DnsMessage

func (*LokiClient) GetName added in v0.22.0

func (c *LokiClient) GetName() string

func (*LokiClient) LogError added in v0.13.0

func (o *LokiClient) LogError(msg string, v ...interface{})

func (*LokiClient) LogInfo added in v0.13.0

func (o *LokiClient) LogInfo(msg string, v ...interface{})

func (*LokiClient) ReadConfig added in v0.13.0

func (o *LokiClient) ReadConfig()

func (*LokiClient) Run added in v0.13.0

func (o *LokiClient) Run()

func (*LokiClient) SendEntries added in v0.13.0

func (o *LokiClient) SendEntries(buf []byte)

func (*LokiClient) SetLoggers added in v0.22.0

func (c *LokiClient) SetLoggers(loggers []dnsutils.Worker)

func (*LokiClient) Stop added in v0.13.0

func (o *LokiClient) Stop()

type LokiStream added in v0.17.0

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

func (*LokiStream) Encode2Proto added in v0.17.0

func (o *LokiStream) Encode2Proto() ([]byte, error)

func (*LokiStream) Init added in v0.17.0

func (o *LokiStream) Init()

func (*LokiStream) ResetEntries added in v0.17.0

func (o *LokiStream) ResetEntries()

type Prometheus added in v0.15.0

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

func NewPrometheus added in v0.15.0

func NewPrometheus(config *dnsutils.Config, logger *logger.Logger, version string, name string) *Prometheus

func (*Prometheus) Channel added in v0.15.0

func (o *Prometheus) Channel() chan dnsutils.DnsMessage

func (*Prometheus) ComputeEps added in v0.22.0

func (o *Prometheus) ComputeEps()

func (*Prometheus) GetName added in v0.22.0

func (c *Prometheus) GetName() string

func (*Prometheus) InitProm added in v0.15.0

func (o *Prometheus) InitProm()

func (*Prometheus) ListenAndServe added in v0.15.0

func (s *Prometheus) ListenAndServe()

func (*Prometheus) LogError added in v0.15.0

func (o *Prometheus) LogError(msg string, v ...interface{})

func (*Prometheus) LogInfo added in v0.15.0

func (o *Prometheus) LogInfo(msg string, v ...interface{})

func (*Prometheus) ReadConfig added in v0.16.0

func (o *Prometheus) ReadConfig()

func (*Prometheus) Record added in v0.15.0

func (o *Prometheus) Record(dm dnsutils.DnsMessage)

func (*Prometheus) Run added in v0.15.0

func (s *Prometheus) Run()

func (*Prometheus) SetLoggers added in v0.22.0

func (c *Prometheus) SetLoggers(loggers []dnsutils.Worker)

func (*Prometheus) Stop added in v0.15.0

func (o *Prometheus) Stop()

type RestAPI added in v0.25.0

type RestAPI struct {
	HitsStream HitsStream
	HitsUniq   HitsUniq

	Streams map[string]int `json:"streams"`

	TopQnames      *topmap.TopMap
	TopClients     *topmap.TopMap
	TopTLDs        *topmap.TopMap
	TopNonExistent *topmap.TopMap
	TopServFail    *topmap.TopMap

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewRestAPI added in v0.25.0

func NewRestAPI(config *dnsutils.Config, logger *logger.Logger, version string, name string) *RestAPI

func (*RestAPI) BasicAuth added in v0.25.0

func (o *RestAPI) BasicAuth(w http.ResponseWriter, r *http.Request) bool

func (*RestAPI) Channel added in v0.25.0

func (o *RestAPI) Channel() chan dnsutils.DnsMessage

func (*RestAPI) GetClientsHandler added in v0.25.0

func (s *RestAPI) GetClientsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetDomainsHandler added in v0.25.0

func (s *RestAPI) GetDomainsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetName added in v0.25.0

func (c *RestAPI) GetName() string

func (*RestAPI) GetNxDomainsHandler added in v0.25.0

func (s *RestAPI) GetNxDomainsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetSearchHandler added in v0.28.0

func (s *RestAPI) GetSearchHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetSfDomainsHandler added in v0.25.0

func (s *RestAPI) GetSfDomainsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetStreamsHandler added in v0.28.0

func (s *RestAPI) GetStreamsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetSuspiciousHandler added in v0.25.0

func (s *RestAPI) GetSuspiciousHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTLDsHandler added in v0.25.0

func (s *RestAPI) GetTLDsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopClientsHandler added in v0.25.0

func (s *RestAPI) GetTopClientsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopDomainsHandler added in v0.25.0

func (s *RestAPI) GetTopDomainsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopNxDomainsHandler added in v0.25.0

func (s *RestAPI) GetTopNxDomainsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopSfDomainsHandler added in v0.25.0

func (s *RestAPI) GetTopSfDomainsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) GetTopTLDsHandler added in v0.25.0

func (s *RestAPI) GetTopTLDsHandler(w http.ResponseWriter, r *http.Request)

func (*RestAPI) ListenAndServe added in v0.25.0

func (s *RestAPI) ListenAndServe()

func (*RestAPI) LogError added in v0.25.0

func (o *RestAPI) LogError(msg string, v ...interface{})

func (*RestAPI) LogInfo added in v0.25.0

func (o *RestAPI) LogInfo(msg string, v ...interface{})

func (*RestAPI) ReadConfig added in v0.25.0

func (o *RestAPI) ReadConfig()

func (*RestAPI) RecordDnsMessage added in v0.25.0

func (s *RestAPI) RecordDnsMessage(dm dnsutils.DnsMessage)

func (*RestAPI) Run added in v0.25.0

func (s *RestAPI) Run()

func (*RestAPI) SetLoggers added in v0.25.0

func (c *RestAPI) SetLoggers(loggers []dnsutils.Worker)

func (*RestAPI) Stop added in v0.25.0

func (o *RestAPI) Stop()

type SearchBy added in v0.25.0

type SearchBy struct {
	Clients map[string]*HitsRecord
	Domains map[string]*HitsRecord
}

type StatsPerStream added in v0.21.0

type StatsPerStream struct {
	TotalPackets       int
	TotalSentBytes     int
	TotalReceivedBytes int

	Clients   map[string]int
	Domains   map[string]int
	Nxdomains map[string]int

	RRtypes    map[string]int
	Rcodes     map[string]int
	Operations map[string]int
	Transports map[string]int
	IPproto    map[string]int

	TopRcodes     *topmap.TopMap
	TopOperations *topmap.TopMap
	TopIPproto    *topmap.TopMap
	TopTransport  *topmap.TopMap
	TopRRtypes    *topmap.TopMap
}

type StatsdClient added in v0.14.0

type StatsdClient struct {
	Stats StreamStats
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewStatsdClient added in v0.14.0

func NewStatsdClient(config *dnsutils.Config, logger *logger.Logger, version string, name string) *StatsdClient

func (*StatsdClient) Channel added in v0.14.0

func (o *StatsdClient) Channel() chan dnsutils.DnsMessage

func (*StatsdClient) GetName added in v0.22.0

func (c *StatsdClient) GetName() string

func (*StatsdClient) LogError added in v0.14.0

func (o *StatsdClient) LogError(msg string, v ...interface{})

func (*StatsdClient) LogInfo added in v0.14.0

func (o *StatsdClient) LogInfo(msg string, v ...interface{})

func (*StatsdClient) ReadConfig added in v0.14.0

func (o *StatsdClient) ReadConfig()

func (*StatsdClient) RecordDnsMessage added in v0.25.0

func (o *StatsdClient) RecordDnsMessage(dm dnsutils.DnsMessage)

func (*StatsdClient) Run added in v0.14.0

func (o *StatsdClient) Run()

func (*StatsdClient) SetLoggers added in v0.22.0

func (c *StatsdClient) SetLoggers(loggers []dnsutils.Worker)

func (*StatsdClient) Stop added in v0.14.0

func (o *StatsdClient) Stop()

type StdOut

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

func NewStdOut

func NewStdOut(config *dnsutils.Config, console *logger.Logger, name string) *StdOut

func (*StdOut) Channel

func (o *StdOut) Channel() chan dnsutils.DnsMessage

func (*StdOut) GetName added in v0.22.0

func (c *StdOut) GetName() string

func (*StdOut) LogError

func (c *StdOut) LogError(msg string, v ...interface{})

func (*StdOut) LogInfo

func (c *StdOut) LogInfo(msg string, v ...interface{})

func (*StdOut) ReadConfig

func (c *StdOut) ReadConfig()

func (*StdOut) Run

func (o *StdOut) Run()

func (*StdOut) SetBuffer

func (o *StdOut) SetBuffer(b *bytes.Buffer)

func (*StdOut) SetLoggers added in v0.22.0

func (c *StdOut) SetLoggers(loggers []dnsutils.Worker)

func (*StdOut) Stop

func (o *StdOut) Stop()

type StreamStats added in v0.25.0

type StreamStats struct {
	Streams map[string]*StatsPerStream
}

type Syslog

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

func NewSyslog

func NewSyslog(config *dnsutils.Config, console *logger.Logger, name string) *Syslog

func (*Syslog) Channel

func (o *Syslog) Channel() chan dnsutils.DnsMessage

func (*Syslog) GetName added in v0.22.0

func (c *Syslog) GetName() string

func (*Syslog) LogError

func (o *Syslog) LogError(msg string, v ...interface{})

func (*Syslog) LogInfo

func (o *Syslog) LogInfo(msg string, v ...interface{})

func (*Syslog) ReadConfig

func (c *Syslog) ReadConfig()

func (*Syslog) Run

func (o *Syslog) Run()

func (*Syslog) SetLoggers added in v0.22.0

func (c *Syslog) SetLoggers(loggers []dnsutils.Worker)

func (*Syslog) Stop

func (o *Syslog) Stop()

type TcpClient

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

func NewTcpClient

func NewTcpClient(config *dnsutils.Config, logger *logger.Logger, name string) *TcpClient

func (*TcpClient) Channel

func (o *TcpClient) Channel() chan dnsutils.DnsMessage

func (*TcpClient) GetName added in v0.22.0

func (c *TcpClient) GetName() string

func (*TcpClient) LogError

func (o *TcpClient) LogError(msg string, v ...interface{})

func (*TcpClient) LogInfo

func (o *TcpClient) LogInfo(msg string, v ...interface{})

func (*TcpClient) ReadConfig

func (o *TcpClient) ReadConfig()

func (*TcpClient) Run

func (o *TcpClient) Run()

func (*TcpClient) SetLoggers added in v0.22.0

func (c *TcpClient) SetLoggers(loggers []dnsutils.Worker)

func (*TcpClient) Stop

func (o *TcpClient) Stop()

Jump to

Keyboard shortcuts

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