Home | Syllabus | Schedule | Class Notes | Assignments
University of Alaska Fairbanks
Computer Science Program

CS 205: Intermediate Programming

Assignment: Log Analyzer

Assignment goal: To input a log file file and present a summary of data from the file.

Assignment structure: Write one Perl program that reads input from a log file (available here as lastlog.txt). Parse that input into fields, using appropriate variables or data structures to store them. Provide a summary analysis of the log file including: number of entries; earliest & latest data; total time logged in per user; and total logged in time overall plus average time logged in per day

Required input and output: Prof. Newby will supply a log input file from the Unix/Linux last command. Input the file to your program using a file open command or similar technique. Output is the summary analysis mentioned above.

Input format: man last and man utmp for more information about the "last" logfile format. Fields are fixed length. Fields are:

  1. Username (8 characters max)
  2. Which pseudo-terminal (tty or pty or similar)
  3. Host logged in from (might be truncated)
  4. Login date
  5. Start time for login
  6. End time for login (or another code)
  7. Total login time, which might exceed 24 hours

Further work: Optionally, you could supply additional summary information from the log file. Optionally, you could prompt the user for what summary information to provide, or a range of dates or other values to select from.

Deliverables: Send email to Prof. Newby with two attachments. First is your Perl program. Second is a plain text file showing a sample run of the program.

Grading: 10 points for required functionality, plus up to 2 points for extra functionality, as follows:

Criterion Max. Points Description
Functionality 6 Meets assignment I/O requirements
Legibility 2 Includes comments; neatly written
Parsimony 2 Uses appropriate data structures and syntax; not overly complex or convoluted
Extra work 2 Functionality demonstrating clear understanding beyond the assignment requirements

Most recently updated: