summaryrefslogtreecommitdiffhomepage
path: root/server/rpki.go
diff options
context:
space:
mode:
authordsp <dsp@2f30.org>2016-07-30 14:16:48 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-07-30 12:17:37 +0900
commitc4fe45902e736a858c4870bcab01c9143551f696 (patch)
treecbc45786d584fd98c1fb55851f2200bea938c909 /server/rpki.go
parentbb15c18402ffcb5beb60aa61cfdc57577633f234 (diff)
all logging is done with log.WithFields
Signed-off-by: dsp <dsp@2f30.org> Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/rpki.go')
-rw-r--r--server/rpki.go36
1 files changed, 23 insertions, 13 deletions
diff --git a/server/rpki.go b/server/rpki.go
index c91ee7c0..df105a65 100644
--- a/server/rpki.go
+++ b/server/rpki.go
@@ -158,7 +158,7 @@ func (m *roaManager) AddServer(host string, lifetime int64) error {
lifetime = 3600
}
if _, ok := m.clientMap[host]; ok {
- return fmt.Errorf("roa server exists %s", host)
+ return fmt.Errorf("ROA server exists %s", host)
}
client := NewRoaClient(address, port, m.eventCh, lifetime)
m.clientMap[host] = client
@@ -169,7 +169,7 @@ func (m *roaManager) AddServer(host string, lifetime int64) error {
func (m *roaManager) DeleteServer(host string) error {
client, ok := m.clientMap[host]
if !ok {
- return fmt.Errorf("roa server doesn't exists %s", host)
+ return fmt.Errorf("ROA server doesn't exists %s", host)
}
client.reset()
delete(m.clientMap, host)
@@ -208,7 +208,7 @@ func (m *roaManager) Enable(address string) error {
return nil
}
}
- return fmt.Errorf("roa server not found %s", address)
+ return fmt.Errorf("ROA server not found %s", address)
}
func (m *roaManager) Disable(address string) error {
@@ -219,7 +219,7 @@ func (m *roaManager) Disable(address string) error {
return nil
}
}
- return fmt.Errorf("roa server not found %s", address)
+ return fmt.Errorf("ROA server not found %s", address)
}
func (m *roaManager) Reset(address string) error {
@@ -230,7 +230,7 @@ func (m *roaManager) Reset(address string) error {
return nil
}
}
- return fmt.Errorf("roa server not found %s", address)
+ return fmt.Errorf("ROA server not found %s", address)
}
func (m *roaManager) SoftReset(address string) error {
@@ -242,7 +242,7 @@ func (m *roaManager) SoftReset(address string) error {
return nil
}
}
- return fmt.Errorf("roa server not found %s", address)
+ return fmt.Errorf("ROA server not found %s", address)
}
func (c *roaManager) ReceiveROA() chan *ROAEvent {
@@ -262,12 +262,12 @@ func (m *roaManager) HandleROAEvent(ev *ROAEvent) {
if ev.EventType == CONNECTED {
ev.conn.Close()
}
- log.Error("can't find %s roa server configuration", ev.Src)
+ log.WithFields(log.Fields{"Topic": "rpki"}).Errorf("Can't find %s ROA server configuration", ev.Src)
return
}
switch ev.EventType {
case DISCONNECTED:
- log.Info("roa server is disconnected, ", ev.Src)
+ log.WithFields(log.Fields{"Topic": "rpki"}).Infof("ROA server %s is disconnected", ev.Src)
client.state.Downtime = time.Now().Unix()
// clear state
client.endOfData = false
@@ -279,7 +279,7 @@ func (m *roaManager) HandleROAEvent(ev *ROAEvent) {
client.timer = time.AfterFunc(time.Duration(client.lifetime)*time.Second, client.lifetimeout)
client.oldSessionID = client.sessionID
case CONNECTED:
- log.Info("roa server is connected, ", ev.Src)
+ log.WithFields(log.Fields{"Topic": "rpki"}).Infof("ROA server %s is connected", ev.Src)
client.conn = ev.conn
client.state.Uptime = time.Now().Unix()
client.t = tomb.Tomb{}
@@ -295,9 +295,9 @@ func (m *roaManager) HandleROAEvent(ev *ROAEvent) {
// all stale ROAs were deleted -> timer was cancelled
// so should not be here.
if client.oldSessionID != client.sessionID {
- log.Info("reconnected so ignore timeout", client.host)
+ log.WithFields(log.Fields{"Topic": "rpki"}).Infof("Reconnected to %s. Ignore timeout", client.host)
} else {
- log.Info("delete all due to timeout", client.host)
+ log.WithFields(log.Fields{"Topic": "rpki"}).Infof("Deleting all ROAs due to timeout with:%s", client.host)
m.deleteAllROA(client.host)
}
}
@@ -330,7 +330,13 @@ func (m *roaManager) deleteROA(roa *ROA) {
return
}
}
- log.Info("can't withdraw a roa", roa.Prefix.Prefix.String(), roa.Prefix.Length, roa.AS, roa.MaxLen)
+ log.WithFields(log.Fields{
+ "Topic": "rpki",
+ "Prefix": roa.Prefix.Prefix.String(),
+ "Prefix Length": roa.Prefix.Length,
+ "AS": roa.AS,
+ "Max Length": roa.MaxLen,
+ }).Info("Can't withdraw a ROA")
}
func (m *roaManager) addROA(roa *ROA) {
@@ -419,7 +425,11 @@ func (c *roaManager) handleRTRMsg(client *roaClient, state *config.RpkiServerSta
received.Error++
}
} else {
- log.Info("failed to parse a RTR message ", client.host, err)
+ log.WithFields(log.Fields{
+ "Topic": "rpki",
+ "Host": client.host,
+ "Error": err,
+ }).Info("Failed to parse an RTR message")
}
}