Peer names need to be unique for the logging to successfully work.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menuvi /usr/local/opnsense/service/conf/actions.d/actions_wireguardlogger.conf[restart]
command: /bin/sh -c 'S=/var/db/wg-peer-cron.state; T=$(mktemp /tmp/wg-peer-cron.XXXXXX) || exit 1; M=$(mktemp /tmp/wg-peer-map.XXXXXX) || exit 1; N=$(date +%s); mkdir -p /var/db; python3 -c '\''import xml.etree.ElementTree as ET; root=ET.parse("/conf/config.xml").getroot(); [print(((c.findtext("pubkey") or "").strip())+"|"+((c.findtext("name") or "").strip()))
for c in root.findall("./OPNsense/wireguard/client/clients/client")]'\'' > "$M"; /usr/bin/wg show all dump | awk -F "\t" -v now="$N" '\''NF==9{hs=$6+0; age=(hs>0?now-hs:999999999); st=(hs>0&&age<=300?"connected":"disconnected"); print $1 "|" $2 "|" st "|" hs "|" $4 "|" $5 "|" age}'\'' > "$T" && [ -s "$T" ] || { rm -f "$T" "$M"; exit 0; }; [ -f "$S" ] || : > "
$S"; while IFS="|" read -r IF PK ST HS EP AL AGE; do O=$(awk -F "|" -v i="$IF" -v p="$PK" '\''$1==i && $2==p {print; exit}'\'' "$S"); OS=$(printf "%s" "$O" | awk -F "|" '\''{print $3}'\''); [ -n "$OS" ] || OS=unknown; PN=$(awk -F "|" -v p="$PK" '\''$1==p {print $2; exit}'\'' "$M"); [ -n "$PN" ] || PN=unknown; [ -n "$EP" ] && [ "$EP" != "(none)" ] || EP=unknown
; [ "$ST" = connected ] && [ "$OS" != connected ] && logger -t wireguard -p auth.notice "wireguard peer connected: instance=$IF, peer_name=$PN, peer_pubkey=$PK, endpoint=$EP, allowed_ips=$AL, handshake_age=${AGE}s"; [ "$ST" = disconnected ] && [ "$OS" != disconnected ] && logger -t wireguard -p auth.notice "wireguard peer disconnected: instance=$IF, peer_name=
$PN, peer_pubkey=$PK, endpoint=$EP, allowed_ips=$AL, handshake_age=${AGE}s"; done < "$T"; cut -d"|" -f1-6 "$T" > "$S"; rm -f "$T" "$M"'
parameters:
type: script
message: checking wireguard connections
description: Wireguard connection monitor and loggerservice configd restart
2026-03-13T14:04:00 Notice wireguard wireguard peer connected: instance=wg0, peer_name=phone, peer_pubkey=bOa1clBIOgmJEw2To7+StkqPaA2UxKsjw=, endpoint=192.168.11.65:51888, allowed_ips=192.168.12.2/32, handshake_age=56s
2026-03-13T14:03:00 Notice wireguard wireguard peer disconnected: instance=wg0, peer_name=laptop, peer_pubkey=9V3VB9ALJtB0lgvhpCetVVEbZW6YH6Rnk=, endpoint=192.168.11.228:54553, allowed_ips=192.168.12.3/32, handshake_age=513s
2026-03-13T13:58:12 Notice wireguard wireguard peer disconnected: instance=wg0, peer_name=phone, peer_pubkey=bOa1clBIOgmJEw2To7+StkqPaA2UxKsjw=, endpoint=192.168.11.65:51888, allowed_ips=192.168.12.2/32, handshake_age=381s
2026-03-13T13:54:36 Notice wireguard wireguard peer connected: instance=wg0, peer_name=laptop, peer_pubkey=9V3VB9ALJtB0lgvhpCetVVEbZW6YH6Rnk=, endpoint=192.168.11.228:54553, allowed_ips=192.168.12.3/32, handshake_age=9s
2026-03-13T13:51:57 Notice wireguard wireguard peer connected: instance=wg0, peer_name=phone, peer_pubkey=bOa1clBIOgmJEw2To7+StkqPaA2UxKsjw=, endpoint=192.168.11.65:51888, allowed_ips=192.168.12.2/32, handshake_age=6sQuote from: meyergru on June 05, 2023, 03:04:02 PM
If you use Netflow reporting, you will have /var/log/flowd*.log which are rotated and thus they do not take up much space, but get written A LOT.
There is a setting to have /var/log in the RAM disk to avoid this - you need to reboot to activate it.
With that setting, all logs will get lost on every reboot.
Also, the free space not diminishing is a tell-tale sign of a database that is being written to. In my case, it was Zenarmor, which uses an Sqlite database that was constantly being written to.
iostat -x 1 10
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 46 1.7 852.3 0 0 1 0 0 0
md43 0 0 0.0 1.8 0 0 0 0 0 0
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 424 0.0 9191.4 0 0 1 0 0 1
md43 0 2 0.0 8.0 0 0 0 0 0 0
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 6 0.0 103.9 0 0 1 0 0 0
md43 0 0 0.0 0.0 0 0 0 0 0 0
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 4 0.0 24.0 0 0 1 1 0 0
md43 0 0 0.0 0.0 0 0 0 0 0 0
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 7 0.0 100.0 0 0 1 0 0 1
md43 0 0 0.0 0.0 0 0 0 0 0 0
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 45 0.0 2585.2 0 0 1 0 0 1
md43 0 0 0.0 0.0 0 0 0 0 0 0
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 251 0.0 8193.3 0 0 4 0 0 6
md43 0 1 0.0 4.0 0 0 0 0 0 0
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 4 0.0 32.0 0 9 14 12 0 6
md43 0 0 0.0 0.0 0 0 0 0 0 0
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 4 0.0 56.0 0 0 12 6 0 5
md43 0 0 0.0 0.0 0 0 0 0 0 0
extended device statistics
device r/s w/s kr/s kw/s ms/r ms/w ms/o ms/t qlen %b
nvd0 0 0 0.0 0.0 0 0 0 0 0 0
md43 0 0 0.0 0.0 0 0 0 0 0 0fetch https://raw.githubusercontent.com/stephenw10/WGXepc/master/WGXepc.ccc WGXepc.c -o WGXepcchmod 700 WGXepc ./WGXepc
Found Firebox M370/470/570/670.
WGXepc Version 1.6_1 22/11/2020 stephenw10
WGXepc can accept two arguments:
-f (CPU fan) will return the current and minimum fan speed or if followed
by a number in hex, 00-FF, will set it.
-f2 (System fan) will return the current and minimum fan speed or if followed
by a number in hex, 00-FF, will set it.
-l (led) will set the arm/disarm led state to the second argument:
red, green, red_flash, green_flash, red_flash_fast, green_flash_fast, off
-b (backlight) will set the lcd backlight to the second argument:
on or off. Do not use with LCD driver.
-t (temperature) shows the current CPU temperature reported by the
SuperIO chip. X-e box only.
Not all functions are supported by all models
./WGXepc -f 10