PageRenderTime 38ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/swatch-3.2.3/README

#
#! | 123 lines | 89 code | 34 blank | 0 comment | 0 complexity | f64fecd22f4982895b019e89eeabc797 MD5 | raw file
Possible License(s): GPL-2.0
  1. Thank you for your interest in swatch: the Simple WATCHdog.
  2. Swatch is a SourceForge project whose project page is at
  3. http://sourceforge.net/projects/swatch and homepage is at
  4. http://swatch.sourceforge.net
  5. Swatch was originally written to actively monitor messages as
  6. they are written to a log file via the UNIX syslog utility. For
  7. a simple demonstration type "perl swatch --examine=FILENAME" with
  8. FILENAME being the file that you would like to see the contents of.
  9. All this example will do is demonstrate the different text modes
  10. that are available with to the echo action.
  11. Read the INSTALL file for installation instructions.
  12. IF YOU ENCOUNTER A BUG...
  13. Please send mail to todd.atkins@stanfordalumni.org about it, but first make
  14. sure that it is not mentioned in the KNOWN_BUGS file and that you are
  15. using the latest release.
  16. MAJOR CHANGES IN VERSION 3.1
  17. Added --extra-include-dirs (or -I) and --extra-modules (or -M) command
  18. line options. This allows one to extend the functionality of swatch by
  19. defining customized actions. See the modules in the "examples" directory
  20. to see how this feature can be used.
  21. Changed "-I" command option from being shorthand for
  22. "--input-record-separator" to being short for "--extra-include-dirs"
  23. in order to be more consistent with perl's command line arguments.
  24. Added --tail-program-name and --tail-args command line options. This
  25. allows one to use more robust tail commands like GNU tail. Here is
  26. how I use it to watch multiple files and not have to worry when they
  27. get rotated:
  28. % swatch --tail-prog=/usr/local/bin/gtail \
  29. --tail-args '--follow=name --lines=1' \
  30. --tail-file="/var/log/messages /var/log/snort/alert"
  31. Added possibility for user to overide "message" option to any action.
  32. Changed default tail arguments from "-1 -f" to "-n 0 -f"
  33. Put action and throttle code into modules named Swatch::Actions and
  34. Swatch::Throttle respectively.
  35. Added --awk-field-syntax and --noawk-field-syntax command line options
  36. with --noawk-field-syntax now set as the default
  37. Added option for user to use their own regular expression to extract a
  38. throttle key from a message using greedy pattern matching.
  39. Went back to using the system's tail(1) command for tailing files due
  40. to all of the problems that folks were experiencing with the File::Tail
  41. CPAN module.
  42. Added --use-cpan-file-tail option to users to keep using the File::Tail
  43. module for tailing files.
  44. Added perlcode to configuration file. This allows for perl hackers to
  45. make use of variables in their configuration files. There is a depth
  46. setting which allows the perlcode to be placed in different levels of
  47. the nested blocks that are used in the watcher script. Here is how
  48. one could use it to define generic regular expressions for matching
  49. and defining fields for different styles of log file lines:
  50. # matches Snort pre-processor short alerts
  51. perlcode my $spp_regex = '\[\*\*\]\s+(\[\d+:\d+:\d+\])\s+([^:]*):.*from (\d+\.\d+\.\d+\.\d+)(.*)$';
  52. # matches short Snort alerts ($1 = alert message, $2 = src IP)
  53. perlcode my $snort_regex = '\[\*\*\]\s+(.*)\s+\[\*\*\].*\{\w+\} (\d+\.\d+\.\d+\.\d+)';
  54. # matches syslog lines ($1 set to everything after the timestamp)
  55. perlcode my $syslog_regex = '^\w{3}\s+\d{1,2}\s+\d{2}:\d{2}:\d{2}.*:(.*)';
  56. # report every type of snort alert but throttle them
  57. watchfor /.*/ and /$snort_regex/
  58. throttle 5:00,key=$1 $2
  59. echo modes=green
  60. # report every type of syslog message but throttle them
  61. watchfor /.*/ and /$syslog_regex/
  62. throttle 5:00,key=$1
  63. echo modes=green
  64. OTHER MAJOR CHANGES SINCE VERSION 2.X
  65. The configuration file now has a completely different format. You can still
  66. use your old configuration files if you use the "--old-style-config" switch
  67. if you insist.
  68. I have re-written most a lot of the code to take advantage of features
  69. and modules that were made available with perl 5.
  70. It now requires perl 5 and the following modules: Time::HiRes, Date::Calc,
  71. Date::Format, Date::Manip, Term::ANSIColor, File::Tail.
  72. I have added the seven colors that color xterminals recognize to the echo
  73. action.
  74. The manual is now embedded into the script in POD format. Use pod2text,
  75. pod2html, or your favorite pod2* program to create a more easily readable
  76. document.
  77. FUTURE DIRECTIONS
  78. I am working on a thresholding module that will behave in a manner that is
  79. similar to thresholding in the Snort IDS (www.snort.org). This should
  80. eventually replace the current throttling mechanism.
  81. SUGGESTIONS?
  82. Please mail suggestions, problems, and/or complaints about swatch
  83. to Todd.Atkins@StanfordAlumni.ORG
  84. DONATIONS?
  85. The swatch program is provided to you free of charge. However, if you find
  86. it useful I encourage you to send in a donation toward its continuous
  87. development. Please send donations online via PayPal (www.paypal.com) using
  88. my todd.atkins@stanfordalumni.org address
  89. Thank you.