Skip to content

Instantly share code, notes, and snippets.

Created January 10, 2014 15:20
What would you like to do?
Generate a report of all VPN connects, system sleeps, and "location-awareness" messages for the last seven days. "location-awareness" log messages are generated by ControlPlane actions that are triggered based on my geographical location (home or work).
reportfile=/vpn-reports/`date +%Y-%m-%d`.txt
echo "**** VPN report generated @ `date` ****" > $reportfile
syslog -k Sender pppd \
-k Message "L2TP connection established." \
-o -k Message "L2TP disconnected" \
-o -k Sender location-awareness \
-k Time ge -7d \
-o -k Message Seq "System Sleep" \
-k Sender kernel >> $reportfile
Copy link

pajp commented Jan 10, 2014

  • Needs to be run as root (or maybe admin user) to fetch all messages
  • The "System Sleep" message comes from my Wi-Fi driver (AirPort_Brcm43xx) so that may not appear on all machines (although it's a standard Retina MacBook Pro so it might be quite ubiquitous)

Copy link

pajp commented Jan 10, 2014

The "location-awareness" ControlPlane actions are one-liner shell scripts looking like this:

logger -t location-awareness "Arrived at home"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment