Esempio n. 1
0
def handle500(request):
    # Let's attempt to render a more useful error message
    errorid, ctx, exception = get_exception_info(request)

    # We log the raw error to the log file, so that splunk can pick it up as
    # JSON.
    error_logger.error(json.dumps(exception, sort_keys=True))

    # Build up the URL for making the query
    lang_code = request.LANGUAGE_CODE if hasattr(request,
                                                 'LANGUAGE_CODE') else 'en-us'
    query_args = {
        "q":
        'search index=_internal sourcetype=django_error "%s" | head 1 | spath'
        % errorid,
        "display.events.maxlines":
        0,
        "display.general.type":
        "events",
        "earliest":
        0,
        "latest":
        ""
    }
    query_string = urllib.urlencode(query_args)
    ctx['search_url'] = make_splunkweb_url("/%s/app/search/search?%s" %
                                           (lang_code, query_string))

    return HttpResponseServerError(
        render_to_string('splunkdj:500.html', context_instance=Context(ctx)))
Esempio n. 2
0
def default_search(request):
    app = request.app_name
    lang_code = request.LANGUAGE_CODE
    query_suffix = request.META['QUERY_STRING']
    if query_suffix != '':
        query_suffix = '?' + query_suffix
    return HttpResponseRedirect(make_splunkweb_url("/%s/app/%s/search%s" % 
        (lang_code, app, query_suffix)))
Esempio n. 3
0
def default_search(request):
    app = request.app_name
    lang_code = request.LANGUAGE_CODE
    query_suffix = request.META['QUERY_STRING']
    if query_suffix != '':
        query_suffix = '?' + query_suffix
    return HttpResponseRedirect(
        make_splunkweb_url("/%s/app/%s/search%s" %
                           (lang_code, app, query_suffix)))
Esempio n. 4
0
def handle500(request):    
    # Let's attempt to render a more useful error message
    errorid, ctx, exception = get_exception_info(request)
    
    # We log the raw error to the log file, so that splunk can pick it up as
    # JSON.
    error_logger.error(json.dumps(exception, sort_keys=True))
    
    # Build up the URL for making the query
    lang_code = request.LANGUAGE_CODE if hasattr(request, 'LANGUAGE_CODE') else 'en-us'
    query_args = {
        "q": 'search index=_internal sourcetype=django_error "%s" | head 1 | spath' % errorid,
        "display.events.maxlines": 0,
        "display.general.type": "events",
        "earliest": 0,
        "latest": ""
    }
    query_string = urllib.urlencode(query_args)
    ctx['search_url'] = make_splunkweb_url("/%s/app/search/search?%s" % (lang_code, query_string))
    
    return HttpResponseServerError(render_to_string('splunkdj:500.html', context_instance=Context(ctx)))
Esempio n. 5
0
def default_flashtimeline(request):
    app = request.app_name
    lang_code = request.LANGUAGE_CODE
    return HttpResponseRedirect(make_splunkweb_url("/%s/app/%s/flashtimeline" % (lang_code, app)))
Esempio n. 6
0
def default_search(request):
    app = request.app_name
    lang_code = request.LANGUAGE_CODE
    return HttpResponseRedirect(make_splunkweb_url("/%s/app/%s/search" % (lang_code, app)))
Esempio n. 7
0
def default_flashtimeline(request):
    app = request.app_name
    lang_code = request.LANGUAGE_CODE
    return HttpResponseRedirect(
        make_splunkweb_url("/%s/app/%s/flashtimeline" % (lang_code, app)))
Esempio n. 8
0
def default_search(request):
    app = request.app_name
    lang_code = request.LANGUAGE_CODE
    return HttpResponseRedirect(
        make_splunkweb_url("/%s/app/%s/search" % (lang_code, app)))