mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-08 20:33:58 +01:00
1.6 KiB
1.6 KiB
Logging conventions
A log message (the string/format passed to Info, Error, Debug etc, as well as their Sprintf counterparts) should
be a descriptive message about the event and may contain specific identifying characteristics. Regardless of the
level of detail in the message identifying characteristics should always be included via WithField, WithFields or
WithError
If an error is being logged use l.WithError(err) so that there is better discoverability about the event as well
as the specific error condition.
Common fields
cert- acert.NebulaCertificateobject, do not.String()this manually,logruswill marshal objects properly for the formatter it is using.fingerprint- a singleNebeulaCertificatehex encoded fingerprintfingerprints- an array ofNebulaCertificatehex encoded fingerprintsfwPacket- a FirewallPacket objecthandshake- an object containing:stage- the current stage counterstyle- noise handshake styleix_psk0,xx, etc
header- a nebula header objectudpAddr- anet.UDPAddrobjectudpIp- a udp ip addressvpnIp- vpn ip of the host (remote or local)relay- the vpnIp of the relay host that is or should be handling the relay packetrelayFrom- The vpnIp of the initial sender of the relayed packetrelayTo- The vpnIp of the final destination of a relayed packet
Example:
l.WithError(err).
WithField("vpnIp", IntIp(hostinfo.hostId)).
WithField("udpAddr", addr).
WithField("handshake", m{"stage": 1, "style": "ix"}).
Info("Invalid certificate from host")