aboutsummaryrefslogtreecommitdiffstats
path: root/ingest.py
diff options
context:
space:
mode:
Diffstat (limited to 'ingest.py')
-rw-r--r--ingest.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/ingest.py b/ingest.py
index dc8cf21..0c762c8 100644
--- a/ingest.py
+++ b/ingest.py
@@ -7,30 +7,26 @@ import sys
from defusedxml import ElementTree
-class Ingest:
+class IngestLogfile:
"""log ingestion class"""
- def __init__(self, conn, infile: list = None):
+ def __init__(self, conn):
"""
:param conn: sqlite connection object
- :param infile: list containing log filenames to be ingested
"""
self.conn = conn
- self.infile = infile
self.jid_pattern = re.compile("^(?:([^\"&'/:<>@]{1,1023})@)?([^/@]{1,1023})(?:/(.{1,1023}))?$")
self.message_pattern = re.compile(r'<message.*?</message>', re.DOTALL)
- self.ingest()
-
- def ingest(self):
+ def read(self, infile: list = None):
"""
- ingest method to split up the ingest file list
- if necessary decompression and decoding are applied
+ ingest method to split up the ingest file list, if necessary decompression and decoding are applied
+ :param infile: list containing log filenames to be ingested
"""
magic_number = b"\x1f\x8b\x08"
# iterate over all infile elements
- for element in self.infile:
+ for element in infile:
try:
# open file in binary mode