Tracking User Logins

Sun, 3 Feb 2013

usertracker.pl scans specified log files for information about logged-in users and adds the list of logged users to a file. I had a need to get this information for a system I was working on, couldn't find a program that worked exactly like I wanted, and came to the conclusion that it had to be made. I'm publishing it here just in case it might be helpful to someone else some day.

The software can be obtained from the git repository.

It's written in Perl and needs Getopt::Long, Pod::Usage, YAML, File::ReadBackwards, and Date::Manip.

Run usertracker.pl -h to get more information.

In order to specify the log files and the patterns to match, you must specify the appropriate values in user-track.cfg.

user-track-cfg is in YAML format. A sample file is included, just follow the pattern and it will work. For each log you want to parse, you must specify 3 values: First, Second and Pattern:

Pattern is the regular expression that will match the date and the user in the line.

First and Second specifies the expected order in the line of the date and user field.

There is another file that will keep track of the last time it was run, the file is user-tracker.run, if will be created the first time the script is run (you'll receive a warning message).

usertracker.pl is copyright © 2013 Jason Self

usertracker.pl gives you software freedom; you can copy, modify, convey, and/or redistribute it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program in a file called 'GPLv3.txt'. If not, see http://www.gnu.org/licenses/gpl-3.0-standalone.html or write to the: Free Software Foundation, Inc., 51 Franklin St, Fifth Floor Boston, MA 02110-1301, USA.