Server Logs konfigurieren
Der Log Level und die Formatierung von BFFH können über folgende Wege konfiguriert werden.
Umgebungsvariable
Über die Umgebungsvariable BFFH_LOG=debug
- zum Beispiel eingebunden per systemd Service
Unterstützte Level für BFFH_LOG
sind:
- trace
- debug
- warn
- info
- error
Parameter in bffhd
Über die beiden bffhd
Parameter:
--log-format
- Full (Standard)
- Compact
- Pretty
Full
2024-12-07T11:10:48.198579Z DEBUG bffh:tls: diflouroborane::tls: TLS secret logging is disabled. keylog=false
2024-12-07T11:10:48.198685Z DEBUG bffh:tls: diflouroborane::tls: reading certificates path=/etc/ssl/fablabchemnitz.de.cert.pem
2024-12-07T11:10:48.198959Z DEBUG bffh:tls: diflouroborane::tls: reading private key path=/etc/ssl/fablabchemnitz.de.privkey.pem
2024-12-07T11:10:48.199608Z DEBUG diflouroborane::actors::process: Process actor updating state name=actor-process-test cmd=/opt/fabinfra/actor-process-test.sh state=SendState(ArchivedState { inner: ArchivedMachineState { state: Free, previous: Some(ArchivedUserRef { id: "local_lab_admin" }) } })
2024-12-07T11:10:48.200451Z DEBUG diflouroborane::actors::process: Process actor updating state name=Tasmota_Mjolnir cmd=/opt/fabinfra/adapters/tasmota/main.py state=SendState(ArchivedState { inner: ArchivedMachineState { state: InUse(ArchivedUserRef { id: "local_lab_admin" }), previous: Some(ArchivedUserRef { id: "local_lab_admin" }) } })
2024-12-07T11:10:48.203817Z INFO bffh:binding API listen sockets: diflouroborane::capnp: Opened listen socket on 127.0.0.1:5961
2024-12-07T11:10:48.204079Z INFO bffh:binding API listen sockets: diflouroborane::capnp: Opened listen socket on 192.168.1.192:5961
Compact
Das kompakte Layout ist identisch zu Full
2024-12-07T11:10:48.198579Z DEBUG bffh:tls: diflouroborane::tls: TLS secret logging is disabled. keylog=false
2024-12-07T11:10:48.198685Z DEBUG bffh:tls: diflouroborane::tls: reading certificates path=/etc/ssl/fablabchemnitz.de.cert.pem
2024-12-07T11:10:48.198959Z DEBUG bffh:tls: diflouroborane::tls: reading private key path=/etc/ssl/fablabchemnitz.de.privkey.pem
2024-12-07T11:10:48.199608Z DEBUG diflouroborane::actors::process: Process actor updating state name=actor-process-test cmd=/opt/fabinfra/actor-process-test.sh state=SendState(ArchivedState { inner: ArchivedMachineState { state: Free, previous: Some(ArchivedUserRef { id: "local_lab_admin" }) } })
2024-12-07T11:10:48.200451Z DEBUG diflouroborane::actors::process: Process actor updating state name=Tasmota_Mjolnir cmd=/opt/fabinfra/adapters/tasmota/main.py state=SendState(ArchivedState { inner: ArchivedMachineState { state: InUse(ArchivedUserRef { id: "local_lab_admin" }), previous: Some(ArchivedUserRef { id: "local_lab_admin" }) } })
2024-12-07T11:10:48.203817Z INFO bffh:binding API listen sockets: diflouroborane::capnp: Opened listen socket on 127.0.0.1:5961
2024-12-07T11:10:48.204079Z INFO bffh:binding API listen sockets: diflouroborane::capnp: Opened listen socket on 192.168.1.192:5961
Pretty
2024-12-07T11:09:18.093419Z DEBUG diflouroborane::tls: reading certificates, path: /etc/ssl/fablabchemnitz.de.cert.pem
at bffhd/tls.rs:113
in diflouroborane::tls::tls
in bffh::bffh
2024-12-07T11:09:18.093835Z DEBUG diflouroborane::tls: reading private key, path: /etc/ssl/fablabchemnitz.de.privkey.pem
at bffhd/tls.rs:123
in diflouroborane::tls::tls
in bffh::bffh
2024-12-07T11:09:18.097839Z INFO diflouroborane::capnp: Opened listen socket on 127.0.0.1:5961
at bffhd/capnp/mod.rs:99
in diflouroborane::capnp::binding API listen sockets
in bffh::bffh
2024-12-07T11:09:18.098140Z INFO diflouroborane::capnp: Opened listen socket on 192.168.1.192:5961
at bffhd/capnp/mod.rs:99
in diflouroborane::capnp::binding API listen sockets
in bffh::bffh
--log-level
Die Level sind die gleichen wie BFFH_LOG
Siehe auch Cheat Sheet - Wichtigste Befehle (Übersicht)
--verbose
(-v
)
Dieser Parameter kann bis zu drei mal als Argument angegeben werden und erhöht die Log-Ausgabe zusätzlich. Beispiel:
opt/fabinfra/bffh/target/release/bffhd --config /opt/fabinfra/bffh-data/config/bffh.dhall --verbose --verbose --verbose
oder
opt/fabinfra/bffh/target/release/bffhd --config /opt/fabinfra/bffh-data/config/bffh.dhall -vvv
Log File schreiben
Wer
bffhd
nicht über systemd startet und deshalb auch keine Logs in journalctl schreibt, der kann den Output auch in eine Log-Datei schreiben - hier im Beispiel bffh.log. Wir fangen dabei die Output-Streams stdout
und stderr
gemeinsam ab. Den Parameter --log-level
ignorieren wir, da er bei der normalen Systemausgabe ignoriert wird und führen stattdessen mit BFFH_LOG
an:BFFH_LOG=debug /opt/fabinfra/bffh/target/release/bffhd --config /opt/fabinfra/bffh-data/config/bffh.dhall --log-format Pretty > bffh.log 2>&1