summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-01-02 15:17:23 -0500
committerJim Meyering <jim@meyering.net>2007-01-02 15:17:23 -0500
commit5bd7c60164ab3018f0b4d8f6736849fcf9699162 (patch)
treeb578f5735d289e681028573160226ceb5aa3c90c
parent2f26ab3895818020181c2c6dc93454589448ba3b (diff)
downloadcobbler-5bd7c60164ab3018f0b4d8f6736849fcf9699162.tar.gz
cobbler-5bd7c60164ab3018f0b4d8f6736849fcf9699162.tar.xz
cobbler-5bd7c60164ab3018f0b4d8f6736849fcf9699162.zip
Adding preliminary logger for kickstart activity.
-rwxr-xr-xwatcher.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/watcher.py b/watcher.py
new file mode 100755
index 00000000..20315976
--- /dev/null
+++ b/watcher.py
@@ -0,0 +1,45 @@
+# cobbler mod_python handler for observing kickstart activity
+#
+# Copyright 2007, Red Hat, Inc
+# Michael DeHaan <mdehaan@redhat.com>
+#
+# This software may be freely redistributed under the terms of the GNU
+# general public license.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import time
+from mod_python import apache
+
+def outputfilter(filter):
+
+ # open the logfile (directory be set writeable by installer)
+ logfile = open("/var/log/cobbler/cobbler.log","a+")
+
+ # write the timestamp
+ logfile.write(str(time.asctime()))
+ logfile.write("\t")
+
+ # write the IP address of the client
+ request = filter.req
+ connection = request.connection
+ (address,port) = connection.remote_addr
+ logfile.write(address)
+ logfile.write("\t")
+
+ # write the filename being requested
+ logfile.write(request.the_request)
+ # logfile.write(request.filename)
+ logfile.write("\n")
+
+ # pass-through filter
+ s = filter.read()
+ while s:
+ filter.write(s)
+ s = filter.read()
+ if s is None:
+ filter.close()
+ logfile.close()
+