Splunk Search

How do I chart a single field using a django binding

seanh71
New Member

I have splunk monitoring on a network port, a remote application logs an ASCII number to that port. How do I create a django search/chart pair that will display this number in a line chart?

Tags (2)
0 Karma

stephanefotso
Motivator

here is one example you can use to display your single value.

{% extends "splunkdj:base_with_app_bar.html" %}

{% load splunkmvc %}

{% block title %}Single Value - Web Framework Toolkit{% endblock title %}

{% block css %}
    <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}splunkjs/css/dashboard.css">
    <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}{{app_name}}/custom.css" />

    <style>
        #timerange {
            margin-top: 5px;
            float: right;
        } 

        .panel {
            overflow: visible;
        }
    </style>
{% endblock css %}

{% block content %}
<div class="dashboard-body container-fluid main-section-body" data-role="main">
    <div class="row">
        <div class="span12 dashboard-header clearfix">
            <h2>Single Value</h2>
        </div>
    </div>
    <div class="dashboard-row">
        <div class="dashboard-cell" style="width: 100%;">
            <div class="dashboard-panel">
                <div class="dashboard-element">
                    <div class="panel-head">
                    </div>
                    <div class="panel-body">
                        <p>
                        In this example, the  TimeRange view
                        sets the timebounds for the searche that drive
                        the  Single view.
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="dashboard-row">
        <div class="dashboard-cell" style="width: 100%;">
            <div class="dashboard-panel">
                <div class="dashboard-element">
                    <div class="panel-head">
                        <h3>Single value with time range</h3>
                    </div>
                    <div class="panel-body">
                        {% timerange id="timerange" %}
                        {% single id="single1" managerid="simplesearch1" beforeLabel="_internal event Count: " %}

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock content%}

{% block managers %}
    {% searchmanager id="simplesearch1" search="index=_internal | stats count" 
        preview=True cache=True status_buckets=0 auto_finalize_ec=100000 autostart=True %}
{% endblock managers %}

{% block js %}
<script>
    require(["splunkjs/ready!"], function(mvc) {
        var search1 = mvc.Components.getInstance("simplesearch1");
        var timerange1 = mvc.Components.getInstance("timerange"); 

        timerange1.on("change", function() {
            search1.search.set(timerange1.val());
        });
    });
</script>

{% endblock js %}
SGF
0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...