Community discussions

MikroTik App
 
aoakeley
Member Candidate
Member Candidate
Topic Author
Posts: 170
Joined: Mon May 21, 2012 11:45 am

Wireguard peer [find last-handshake > X]

Tue Nov 15, 2022 11:41 am

Hi,

Whats the correct syntax to find wireguard peers with a last-handshake > X

I have tried all the below, and the results seem really inconsistent, sometimes it 'appears' to give the correct result but most of the time it definitely does not.

/interface/wireguard/peers> print detail where [find last-handshake > 120s]
/interface/wireguard/peers> print detail where [find last-handshake > 2m]
/interface/wireguard/peers> print detail where [find last-handshake > 00:02:00]

Ta

Andy
 
aoakeley
Member Candidate
Member Candidate
Topic Author
Posts: 170
Joined: Mon May 21, 2012 11:45 am

Re: Wireguard peer [find last-handshake > X]  [SOLVED]

Thu Nov 17, 2022 11:31 am

Figured it out... need to convert the format of the timer, and don't need to use [find]
 /interface/wireguard/peers print detail where last-handshake > [:totime "2m"] 
Same applies to anything that has a timer, e.g. DHCP Lease or last-seen
 /ip/dhcp-server/lease print where last-seen>[:totime "4h"] 

Thought worthwhile posting solution as it took a bit of digging to find (well it did for me anyway)..

Who is online

Users browsing this forum: No registered users and 14 guests