-#
-# config.py
-#
-# Default config values and basic wrapper for ConfigParser. New config options
-# should be added to the dictionary below, along with appropriate defaults.
-#
-# Runtime configuration is done through /etc/logparse/logparse.conf (default)
-# or the path specified in the "--config" argument. The file uses the INI
-# syntax, with general options being declared in the [logparse] section and
-# parser-specific options declared in their own sections.
-#
+"""
+This modules contains default config values and basic wrapper for ConfigParser.
+New config options should be added to the dictionary below, along with
+appropriate defaults. Runtime configuration is done through the config file at
+/etc/logparse/logparse.conf (default) or the path specified in the "--config"
+argument. The file uses the INI syntax, with general options being declared in
+the [logparse] section and parser-specific options declared in their own
+sections.
+
+This module provides the following methods:
+ - `loadconf()`: set up ConfigParser and process config file
+"""
from configparser import ConfigParser
from pkg_resources import Requirement, resource_filename
'quiet': False,
'hostname-path': '/etc/hostname',
'parsers': '',
- 'ignore-parsers': ''
+ 'ignore-parsers': '',
+ 'period': '1 day'
},
'html': {
'header': '/etc/logparse/header.html',
'cron': '/var/log/cron.log',
'cpuinfo': '/proc/cpuinfo',
'meminfo': '/proc/meminfo',
+ 'uptime': '/proc/uptime',
'sys': '/var/log/syslog',
'smbd': '/var/log/samba',
'zfs': '/var/log/zpool.log',
'httpd-access': '/var/log/apache2/access.log',
'httpd-error': '/var/log/apache2/error.log'
},
+ 'cron': {
+ 'period': ''
+ },
'mail': {
'to': '',
'from': '',
'timeout': 10,
'port': 7634,
'show-model': False,
+ 'period': ''
},
'sshd': {
- 'sshd-resolve-domains': ''
+ 'sshd-resolve-domains': '',
+ 'period': ''
},
'smbd': {
- 'smbd-resolve-domains': ''
+ 'shares': '^((?!IPC\$).)*$',
+ 'users': '.*',
+ 'smbd-resolve-domains': '',
+ 'period': ''
},
'httpd': {
- 'httpd-resolve-domains': ''
+ 'httpd-resolve-domains': '',
+ 'period': ''
},
'du': {
'paths': ['/', '/etc', '/home'],
'force-write': False
+ },
+ 'ufw': {
+ 'ufw-resolve-domains': '',
+ 'period': ''
+ },
+ 'sudo': {
+ 'period': ''
+ },
+ 'systemctl': {
+ 'period': '',
+ 'show-all': True
}
}
-def locate(filename):
- """
- DEPRECATED: draft method for what is now parsers/load_parsers.py. Kept here
- for historical purposes.
- """
- logger.debug("Searching for {0}".format(filename))
- loc = resource_filename(Requirement.parse(__package__), filename)
- logger.debug("Found {0}".format(loc))
- return loc
def loadconf(configpaths):
"""