Getting Data In

How can I access app's static content via Splunk endpoint?

Leo
Splunk Employee
Splunk Employee

I have a file inside my app that I want to expose through some Splunk endpoint. How can it be done?

Tags (2)
1 Solution

Leo
Splunk Employee
Splunk Employee

Assuming you have an app called 'myapp', you should place your file inside

$SPLUNK_HOME/etc/apps/myapp/appserver/static 

You can then access it from SplunkWeb: http://localhost:8000/static/app/myapp/myfile.png

Alternatively, files placed inside

$SPLUNK_HOME/etc/system/static 

can be accessed via SplunkD: https://localhost:8089/static/myfile.png

View solution in original post

inetmiguel
Explorer

To clarify, http://localhost:8000/static/app/myapp/myfile.png would work for your files in $SPLUNK_HOME/myapp/appserver/static
and
http://localhost:8000/en-US/splunkd/__raw/servicesNS/admin/myapp/static/myfile.png
would work for files in $SPLUNK_HOME/myapp/static.
Make sure to use the first.

jbrodsky_splunk
Splunk Employee
Splunk Employee

And to access the file in your myapp app, it would be:

http://localhost:8000/en-US/splunkd/__raw/servicesNS/admin/myapp/static/myfile.png

MuS
SplunkTrust
SplunkTrust

Just to add, the original posted URI still works like in

http://localhost:8000/static/app/myapp/myfile.png
0 Karma

Leo
Splunk Employee
Splunk Employee

Five years later things have changed a bit. Now to access /etc/system/static file you'd need to go another way:

http://localhost:8000/en-US/splunkd/__raw/servicesNS/admin/search/static/myfile.png

Leo
Splunk Employee
Splunk Employee

Assuming you have an app called 'myapp', you should place your file inside

$SPLUNK_HOME/etc/apps/myapp/appserver/static 

You can then access it from SplunkWeb: http://localhost:8000/static/app/myapp/myfile.png

Alternatively, files placed inside

$SPLUNK_HOME/etc/system/static 

can be accessed via SplunkD: https://localhost:8089/static/myfile.png

skender27
Contributor

Hi,

Thanks for ypur response.
But what about customizing the XML of a dashboard: when i try to change its code I see that they start with the tag and not (as the simple dashboard app shows). How can I change the XML correctly?

When I copy the .css file to the directory ../statis and change the xml of the dashboard I get no results...

Thanks,
Skender,

0 Karma

MuS
SplunkTrust
SplunkTrust

Hi Skender,

if your .css file is in $SPLUNK_HOME/etc/apps/YourApp/appserver/static directory you can use it like this in your dashboard:

<form stylesheet="YourFancy.css"  .... >
0 Karma

Vijaikanth
Path Finder

Correct. The above solution works fine. But if i create a folder inside appserver/static and place the css file inside, then how i will refer that in my dashboard.

eg) appserver/static/folder1/folder2/YourFancy.css

In Dashboard it should be like

form stylesheet="folder1/folder2/YourFancy.css"...

For me it is not working. Kindly suggest how to access a file if place inside a folder..

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!

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...

Splunk Developers: Construct Your Future at the .conf26 Builder Bar

Calling all Splunk architects, platform admins, and app developers: the site is open, and the blueprints are ...

Quick connection discovery mode for forwarders

When a Splunk forwarder loses connectivity to its indexers, it does not always reconnect immediately. In many ...