Splunk Search

Use variable from views.py on a Django search manager

gustavomichels
Path Finder

Hi all,

Using Splunk 6.2.2.

I want to use a single Django template for several different sources that follow the same format. I was able to set the rules in urls.py and send the expected variables to the template through views.py, as I can successfully use the variables in the content area for the template. Like:

<p class="description">Overview of the operational status for {{ pagetitle }}</p>

Now I need to use variables in search managers, for example:

    {% searchmanager
        id="search1"
        search="| inputlookup apps | search app={{ appname }}"
        cache=True
    %}

And this doesn't work.

I've seen a solution in http://answers.splunk.com/answers/181510/how-to-use-django-template-tags-inside-a-search-ma.html but I am trying to prevent doing stuff directly and JS and I'd rather have a clean Django solution.

Does anyone have any idea?

Thank you

Tags (2)
0 Karma
1 Solution

gustavomichels
Path Finder

Answering myself:

     {% searchmanager
         id="search1"
         search="| inputlookup apps | search app="|add:appname
         cache=True
     %}

View solution in original post

0 Karma

gustavomichels
Path Finder

Answering myself:

     {% searchmanager
         id="search1"
         search="| inputlookup apps | search app="|add:appname
         cache=True
     %}
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...