#!/bin/csh -f # acclog_filter # ----------------------------------------------------------------------------- # C shell script browse the acclog, filtering out my IP address, and # translating some known IP addresses to meaningful names. Useful as: # ssh remote_host acclog_filter # ----------------------------------------------------------------------------- # Usage: Run with -h or --help option to see usage. # Assumptions: # Effects: # Notes: # Implementation Notes: # Portability Issues: # Revision History: # $Log$ # ----------------------------------------------------------------------------- # Collect command line options set option_quick_string = "" set option_all_string = "" set less_cmd = "less" while ($#argv > 0) if ("$1" == "-h" || "$1" == "--help") then echo "Usage: $0:t [options]" echo "Options:" echo " -h = Show this help text" echo " --help = Show this help text" echo " -q = Quick. Most recent log only" echo " --quick = Quick. Most recent log only" echo " -a = All logs" echo " --all = All logs" echo " -n = Not piped through less" echo " --noless = Not piped through less" exit 1 else if ("$1" == "-q" || "$1" == "--quick") then set option_quick_string = "$1" shift else if ("$1" == "-a" || "$1" == "--all") then set option_all_string = "$1" shift else if ("$1" == "-n" || "$1" == "--noless") then shift set less_cmd = "cat" else if ("-" == "`echo $1:q | cut -c 1`") then echo "Error: Invalid option: $1:q" $0 --help exit 1 else # Not a recognized option. Assume it's the first argument break endif end # No arguments defined, so allow none if ($#argv > 0) then beep "Error: No args supported by $0:t" $0 -h exit 1 endif acclog $option_quick_string $option_all_string --noless \ | filter_bots \ | filter_cruft \ | ip_to_name \ | $less_cmd # | grep -v 108.52.154.247 \