Documentation
¶
Index ¶
- Constants
- type DB
- func (db *DB) AddHost(h *Host)
- func (db *DB) AddNotify(n *Notify)
- func (db *DB) Alert(expired time.Duration, send func(e *log.Entry, n *Notify) bool)
- func (db *DB) ChangeHostname(h *Host, name string)
- func (db *DB) DeleteHost(h *Host)
- func (db *DB) GetHost(str string) *Host
- func (db *DB) InitHost()
- func (db *DB) InitNotify()
- func (db *DB) NewHost(addr string) *Host
- func (db *DB) NewNotify(to string) *Notify
- func (db *DB) SendTo(e *log.Entry) (*log.Entry, *Host, []*Notify)
- type Host
- type Notify
Constants ¶
View Source
const AlertMsg = "alert service from logmania, device did not send new message for a while"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// depraced Format -> transformation to new format by db.update()
Hostname map[string]string `json:"hostname,omitempty"`
HostTo map[string]map[string]bool `json:"host_to,omitempty"`
MaxPrioIn map[string]logstd.Level `json:"maxLevel,omitempty"`
RegexIn map[string]map[string]*regexp.Regexp `json:"regexIn,omitempty"`
Lastseen map[string]time.Time `json:"lastseen,omitempty"`
LastseenNotify map[string]time.Time `json:"-"`
// new format
Hosts []*Host `json:"hosts"`
HostsByAddress map[string]*Host `json:"-"`
HostsByName map[string]*Host `json:"-"`
Notifies []*Notify `json:"notifies"`
NotifiesByAddress map[string]*Notify `json:"-"`
DefaultNotify []*Notify `json:"-"`
}
func ReadDBFile ¶
func (*DB) ChangeHostname ¶
func (*DB) DeleteHost ¶
func (*DB) InitNotify ¶
func (db *DB) InitNotify()
type Host ¶
type Host struct {
Name string `json:"name"`
Address string `json:"address"`
Lastseen time.Time `json:"lastseen,omitempty"`
LastseenNotify time.Time `json:"lastseen_notify,omitempty"`
Notifies []string `json:"notifies"`
NotifiesByAddress map[string]*Notify `json:"-"`
}
func (*Host) DeleteNotify ¶
type Notify ¶
type Notify struct {
Protocol string `json:"proto"`
To string `json:"to"`
RegexIn map[string]*regexp.Regexp `json:"regexIn"`
RegexReplace map[string]string `json:"regexReplace"`
MaxPrioIn logstd.Level `json:"maxLevel"`
// contains filtered or unexported fields
}
func (*Notify) AddRegexReplace ¶
func (*Notify) RunReplace ¶
Click to show internal directories.
Click to hide internal directories.