diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2007-01-22 18:14:53 -0500 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-01-22 18:14:53 -0500 |
commit | a45f326cd6969e665264fa559e2ecd124d0d6e20 (patch) | |
tree | b2ef96689b269ed096f3cc3055534935838fe4e2 /swatcher.py | |
parent | 5096df419ef4e3057782096fc0adc7f5e54d2037 (diff) | |
download | third_party-cobbler-a45f326cd6969e665264fa559e2ecd124d0d6e20.tar.gz third_party-cobbler-a45f326cd6969e665264fa559e2ecd124d0d6e20.tar.xz third_party-cobbler-a45f326cd6969e665264fa559e2ecd124d0d6e20.zip |
Adding cobbler syslog service
Diffstat (limited to 'swatcher.py')
-rw-r--r-- | swatcher.py | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/swatcher.py b/swatcher.py deleted file mode 100644 index aa36401..0000000 --- a/swatcher.py +++ /dev/null @@ -1,50 +0,0 @@ -# cobbler daemon for logging remote syslog traffic during kickstart -# -# 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 socket -import time - -import cobbler.api as cobbler_api - -bootapi = cobbler_api.BootAPI() -settings = bootapi.settings() -port = settings.syslog_port - -s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -s.bind((socket.gethostname(), port)) - -buf = 1024 - -while 1: - data, addr = s.recvfrom(buf) - (ip, port) = addr - if not data: - break - else: - logfile = open("/var/log/cobbler/syslog/%s" % ip, "a+") - t = time.localtime() - # write numeric time - seconds = str(time.mktime(t)) - logfile.write(seconds) - logfile.write("\t") - # write string time - timestr = str(time.asctime(t)) - logfile.write(timestr) - logfile.write("\t") - # write the IP address of the client - logfile.write(ip) - logfile.write("\t") - # write the data - logfile.write(data) - logfile.write("\n") - logfile.close() - |