Esempio n. 1
0
def show_log(id):
    data = {}
    rows = request.headers.get('rows')
    waf = request.headers.get('waf')
    grep = request.headers.get('grep')
    hour = request.headers.get('starthour')
    minut = request.headers.get('startminut')
    hour1 = request.headers.get('endhour')
    minut1 = request.headers.get('endminut')

    if rows is None:
        rows = '10'
    if waf is None:
        waf = '0'
    if hour is None:
        hour = '00'
    if minut is None:
        minut = '00'
    if hour1 is None:
        hour1 = '24'
    if minut1 is None:
        minut1 = '00'

    try:
        servers = check_permit_to_server(id)

        for s in servers:
            ip = s[2]
    except:

        data[id] = {"error": "Cannot find the server"}
        return dict(error=data)

    out = funct.show_haproxy_log(ip,
                                 rows=rows,
                                 waf=str(waf),
                                 grep=grep,
                                 hour=str(hour),
                                 minut=str(minut),
                                 hour1=str(hour1),
                                 minut1=str(minut1),
                                 html=0)
    data = {id: out}

    return dict(log=data)
Esempio n. 2
0
    data = response.content
    print(data.decode('utf-8'))

if serv is not None and form.getvalue('rows') is not None:
    rows = form.getvalue('rows')
    waf = form.getvalue('waf')
    grep = form.getvalue('grep')
    hour = form.getvalue('hour')
    minut = form.getvalue('minut')
    hour1 = form.getvalue('hour1')
    minut1 = form.getvalue('minut1')
    out = funct.show_haproxy_log(serv,
                                 rows=rows,
                                 waf=waf,
                                 grep=grep,
                                 hour=hour,
                                 minut=minut,
                                 hour1=hour1,
                                 minut1=minut1)
    print(out)

if serv is not None and form.getvalue('rows1') is not None:
    rows = form.getvalue('rows1')
    grep = form.getvalue('grep')
    hour = form.getvalue('hour')
    minut = form.getvalue('minut')
    hour1 = form.getvalue('hour1')
    minut1 = form.getvalue('minut1')
    date = hour + ':' + minut
    date1 = hour1 + ':' + minut1
    apache_log_path = sql.get_setting('apache_log_path')