new parser class structure
[logparse.git] / logparse / util.py
index 1a1cca5682bcef4068b36248a04d5c3eea4c3ab8..8f905f470b297dcf2d60d5c4722f3641267dba52 100644 (file)
@@ -8,13 +8,15 @@ import re
 import os
 import socket
 import inspect
+from systemd import journal
+from datetime import datetime, timedelta
 
 import logging
 logger = logging.getLogger(__name__)
 
 from pkg_resources import Requirement, resource_filename
 
-from . import config
+from logparse import config
 
 def hostname(path): # get the hostname of current server
     hnfile = open(path, 'r')
@@ -29,7 +31,7 @@ def getlocaldomain(): # get the parent fqdn of current server
     else:
         return domain[-1]
 
-def resolve(ip, fqdn = 'host-only'):        # try to resolve an ip to hostname
+def resolve(ip, fqdn=None):        # try to resolve an ip to hostname
     # Possible values for fqdn:
     #   fqdn            show full hostname and domain
     #   fqdn-implicit   show hostname and domain unless local
@@ -38,7 +40,7 @@ def resolve(ip, fqdn = 'host-only'):        # try to resolve an ip to hostname
     # resolve-domains defined in individual sections of the config take priority over global config
     
     if not fqdn:
-        fqdn = config.prefs['resolve-domains']
+        fqdn = config.prefs.get("logparse", "resolve-domains")
 
     if fqdn == 'ip':
         return(ip)