OPS435 Lab 6 - Bash

From CDOT Wiki
(Redirected from OPS435 Lab 6)
Jump to: navigation, search

Write a script that will examine the latest 15 log files, looking for potential attacks on Apache. Specifically:

  • The files it will examine start with access_log.1, access_log.2 and end with access_log.15
    • Use a for(()) loop to iterate through all these filenames.
    • If the file contains the string "Access denied" - the name of the file should be added to an array.
  • After your loop finishes - your array will contain the filename of every log file that contains a potential attack.
  • Use another for(()) loop to print all these filenames.

You could solve the problem without for(()) loops and the array but since that's the point of the exercise - please use them.