All Apps and Add-ons

link_switcher.js doesn't work

clairebesson
Explorer

Hi everyone ! I am trying to create a menu with link switcher. I have tested the example of custom_link_switcher in Splunk 6.x. Dashboards Examples in my own dashboard. And it didn't work.
<dashboard script="link_switcher.js, autodiscover.js">

<row grouping="4">
    <html>
        <!-- Placeholder/container for the link switcher to appear -->
        <div class="link-switcher" data-items="link1,link2,link3">Select a view: <!--Links go here--></div>
    </html>
    <table id="link1">
        <title>Table</title>
        <searchString>index=_internal | stats count by sourcetype</searchString>
        <earliestTime>-24h</earliestTime>
    </table>
    <chart id="link2">
        <title>Chart</title>
        <searchString>index=_internal | stats count by sourcetype</searchString>
        <earliestTime>-24h</earliestTime>
    </chart>
    <map id="link3">
        <title>Map</title>
        <searchString>| inputlookup geomaps_data.csv | iplocation device_ip | geostats latfield=lat longfield=lon count by method</searchString>
        <earliestTime>0</earliestTime>
        <option name="mapping.map.center">(30.810646,-10.556976)</option>
        <option name="mapping.map.zoom">2</option>
    </map>
</row>

</dashboard>

I implemented this code and I had this dashboard :alt text

As you can see the 3 panels are in the dashboard and there is no link switcher.
Could you please help me with that ?
Thanks in advance.

0 Karma
1 Solution

alacercogitatus
SplunkTrust
SplunkTrust

The autodiscover.js and link_switcher.js files need to be placed in $APP_HOME/appserver/static, where $APP_HOME is the name of the App your dashboard is located. Once they are in that folder, restart Splunk.

If you want to break all caches, click the button at: https://your_splunk/en-US/_bump.

View solution in original post

alacercogitatus
SplunkTrust
SplunkTrust

The autodiscover.js and link_switcher.js files need to be placed in $APP_HOME/appserver/static, where $APP_HOME is the name of the App your dashboard is located. Once they are in that folder, restart Splunk.

If you want to break all caches, click the button at: https://your_splunk/en-US/_bump.

clairebesson
Explorer

My dashboards are in the app "Search & Reporting" (folder name: search). I tried search/appserver/static but it didn't work : "Page not found"

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

"Page Not Found" --- what page? the dashboard? Can you paste the entire 404 error? from the developer console?

0 Karma

clairebesson
Explorer

that's good now thanks

0 Karma

jeffland
SplunkTrust
SplunkTrust

Just to make sure, you did put the .js files in the right places, restarted your splunk and reloaded your browser page without cache (STRG-F5)?

0 Karma

clairebesson
Explorer

Thanks for your answer
The problem is that I don't know where I have to put the .js files with Splunk (I am a very beginner ! )

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!

How much can you really learn in 3 minutes?

Observability can certainly be hard to understand – there's a lot of jargon and buzzwords and it seems to ...

Event Series: The Agentic SOC: Trust Before Autonomy

AI is fundamentally changing security operations, but true progress requires more than just automation—it ...

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...