Commit 9fc45c59 authored by ale's avatar ale

fix missing imports

parent b041e5e4
......@@ -15,8 +15,8 @@ DEFAULT_ES_URL = 'localhost:9200'
def run_http_server(lens, opts, args):
server = www_app.make_app()
server.serve_forever(opts.http_port)
app = www_app.make_app()
app.run(port=opts.http_port)
def create_syslog_parser(opts):
......@@ -102,7 +102,7 @@ Known commands:
parser.add_option('--patterns', dest='pattern_file', metavar='FILE',
help='Read patterns to extract from FILE')
parser.add_option('--port', dest='http_port', metavar='PORT',
default='8081',
default=8081, type='int',
help='TCP port for the HTTP server (default 8081)')
parser.add_option('--range', dest='time_range', metavar='TIMESPEC',
help='Only search within the specified time range')
......
import logging
from lens2 import utils
from flask import Blueprint, Flask, abort, redirect, request, \
g, current_app, jsonify
......@@ -12,8 +13,10 @@ def api_search():
query = request.form['q']
start = int(request.form.get('start', 0))
page_size = int(request.form.get('page_size', 20))
time_range = utils.parse_time_range('time_range', '1d')
time_range = utils.parse_time_range(
request.form.get('time_range', '1d'))
except (KeyError, ValueError):
log.exception('search not parsed')
abort(400)
results, total = current_app.logstore.search(
......
......@@ -9,8 +9,8 @@ def make_app(config={}):
app.config.update(config)
app.config.from_envvar('APP_SETTINGS', silent=True)
app.register_blueprint(api_app)
app.register_blueprint(ui_app)
app.register_blueprint(www_api.api_app)
app.register_blueprint(www_ui.ui_app)
server_list = config.get('ES_SERVER', 'localhost:9200')
app.logstore = logstore.LogStore(server_list)
......
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