-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
91 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
### 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` - a `cert.NebulaCertificate` object, do not `.String()` this manually, `logrus` will marshal objects properly | ||
for the formatter it is using. | ||
- `fingerprint` - a single `NebeulaCertificate` hex encoded fingerprint | ||
- `fingerprints` - an array of `NebulaCertificate` hex encoded fingerprints | ||
- `fwPacket` - a FirewallPacket object | ||
- `handshake` - an object containing: | ||
- `stage` - the current stage counter | ||
- `style` - noise handshake style `ix_psk0`, `xx`, etc | ||
- `header` - a nebula header object | ||
- `udpAddr` - a `net.UDPAddr` object | ||
- `udpIp` - a udp ip address | ||
- `vpnIp` - vpn ip of the host (remote or local) | ||
- `relay` - the vpnIp of the relay host that is or should be handling the relay packet | ||
- `relayFrom` - The vpnIp of the initial sender of the relayed packet | ||
- `relayTo` - 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"}). | ||
WithField("cert", remoteCert). | ||
Info("Invalid certificate from host") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters