Created
January 10, 2014 15:20
-
-
Save pajp/8356234 to your computer and use it in GitHub Desktop.
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).
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
#!/bin/sh | |
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 |
Author
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)
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