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
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...