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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...