Example: Drilldown properties using Django tags

Django Bindings has been deprecated. For more, see the Deprecation Notice.

This example uses Django tags to show the result of setting different combinations of drilldown properties for the views that allow drilldown actions.

[example]

To use this code save it as an HTML file under an existing app in $SPLUNK_HOME/etc/apps/app_name/django/app_name/templates. This example also uses search results from a sample earthquakes lookup table for the SplunkMap view, and includes lat and lon fields in the search query. To try it for yourself, download earthquakes.csv to a /lookups directory under $SPLUNK_HOME/etc/apps/your_app_name. Then, view the page in Splunk. For example, to view mypage.html in mysplunkapp, go to http://<localhost:port>/dj/mysplunkapp/mypage. For more about creating an app, see How to create a Web Framework app using Django Bindings.

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

{% load splunkmvc %}

{% block title %}Drilldown properties (Django){% endblock title %}

{% block css %}
    <style>
        .main-area {
            padding: 30px;
        }
    </style>
{% endblock css %}

{% block content %}
<div>
    <div class="main-area">
        <p>You can set drilldown properties for the EventsViewer, Chart, Table, and SplunkMap views. This example shows different ways to set these properties in Django tags.</p>        
    </div>

    <h4>Disable drilldown redirect--events look clickable but nothing happens (drilldownRedirect=False):</h4>
    {% eventsviewer 
        id="example-viewer" managerid="main-search" softWrap=True
        drilldownRedirect=False %}

    <h4>Disable drilldown (drilldown="none"):</h4>
    {% chart id="example-chart" managerid="subsearch1" type="bar"
        drilldown="none" %}

    <h4>Enable drilldown for individual table cells rather than rows (drilldown="cell"):</h4>
    {% table id="example-table" managerid="subsearch2" wrap=True
        drilldown="cell" %}

    <h4>Enable drilldown and enable redirect (no change from default behavior):</h4>
    {% splunkmap id="example-map" managerid="map-search" 
        drilldown=True 
        drilldownRedirect=True %}
</div>
{% endblock content%}

{% block managers %}
    {% searchmanager id="main-search"  
        search="index=_internal | head 100 | fields *" %} 
    {% postprocessmanager id="subsearch1" managerid="main-search" 
        search=" | stats count by sourcetype" %} 
    {% postprocessmanager id="subsearch2" managerid="main-search" 
        search=" | fields sourcetype, source, host" %} 
    {% searchmanager id="map-search" 
        search="| inputlookup earthquakes.csv | rename Lat as lat Lon as lon | geostats count" %} 
{% endblock managers %}