]> gitweb.michael.orlitzky.com - djbdns-logparse.git/blobdiff - bin/djbdns-logparse
doc/README: siphon the description and history from bin/djbdns-logparse.
[djbdns-logparse.git] / bin / djbdns-logparse
index 44514f15b4c610882cfa7ab03a4f647c091f6818..2e184d814228a39d1992cd3eb581dba317dc74d7 100755 (executable)
@@ -3,28 +3,7 @@
 Convert tinydns and dnscache logs to human-readable form
 """
 
-#
-# Reads log files from tinydns and/or dnscache and prints them out in
-# human-readable form. Logs can be supplied on stdin, or listed on the
-# command line:
-#
-#   $ cat @*.s | djbdns-logparse
-#   $ djbdns-logparse @*.s
-#   $ tail -f current | djbdns-logparse
-#
-# Pipes each log file through tai64nlocal, which must be on your path.
-#
-# Acknowledgments:
-#
-# * The log format descriptions by Rob Mayoff were invaluable:
-#   ** http://dqd.com/~mayoff/notes/djbdns/tinydns-log.html
-#   ** http://dqd.com/~mayoff/notes/djbdns/dnscache-log.html
-#
-# * Faried Nawaz's dnscache log parser was the original inspiration:
-#   ** http://www.hungry.com/~fn/dnscache-log.pl.txt
-#
-
-import sys, re
+import re
 from struct import pack
 from time import strftime, gmtime
 from subprocess import Popen, PIPE
@@ -238,11 +217,12 @@ def main():
 
     # Parse zero or more positional arguments into a list of
     # "logfiles". If none are given, read from stdin instead.
+    from sys import stdin
     parser.add_argument("logfiles",
                         metavar="LOGFILE",
                         type=FileType("r"),
                         nargs="*",
-                        default=[sys.stdin],
+                        default=[stdin],
                         help="djbdns logfile to process (default: stdin)")
 
     args = parser.parse_args()