Commit ecd2f4a7 authored by godog's avatar godog

list available syslog parsers

parent 94c5658f
......@@ -12,6 +12,7 @@ from lens2 import www_app
log = logging.getLogger(__name__)
DEFAULT_ES_URL = 'localhost:9200'
SYSLOG_PARSERS = syslog_parser.list_parsers()
def run_http_server(lens, opts, args):
......@@ -112,8 +113,8 @@ Known commands:
default=DEFAULT_ES_URL,
help='URL for the ES servers (default %default)')
parser.add_option('--log-format', dest='log_format',
default='standard', metavar='FMT',
help='Log format ("standard" or "iso")')
default='standard', metavar='FMT', choices=SYSLOG_PARSERS,
help='Log format (%s)' % ', '.join(SYSLOG_PARSERS))
daemonize.add_options(parser)
opts, args = parser.parse_args()
if len(args) < 1:
......
......@@ -21,6 +21,9 @@ def register_parser(name, class_):
def get_parser(name, **args):
return _parser_registry[name](**args)
def list_parsers():
return _parser_registry.keys()
class SyslogParserBase(object):
"""Base parser class for syslog data."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment