Skip to content
Snippets Groups Projects
Commit 37b01c2f authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Update to newer IntelMQ

parent 30030682
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import io
import socket
import time
import errno
import os
from os import path
from sys import argv
from intelmq.lib.bot import Bot
from intelmq.lib.exceptions import ConfigurationError
......@@ -61,16 +59,12 @@ class FilesOutputBot(Bot):
# Now we know the device/inode, rename to make unique within system
newname = self._get_new_name(fd)
os.rename(path.join(self.tmp, tmpname), path.join(self.tmp, newname))
nf = io.open(fd, "w", encoding="utf-8")
nf = io.open(fd, "w", encoding="utf-8") # FIXME (py3)
return nf, newname
def process(self):
event = self.receive_message()
if not event:
self.acknowledge_message()
return
event_data = event.to_json()
f, name = self.create_unique_file()
f.write(event_data)
......@@ -80,6 +74,4 @@ class FilesOutputBot(Bot):
self.acknowledge_message()
if __name__ == "__main__":
bot = FilesOutputBot(argv[1])
bot.start()
BOT = FilesOutputBot
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment