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
Legend

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
Legend

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!

Stay Connected: Your Guide to July and August Tech Talks, Office Hours, and Webinars!

Dive into our sizzling summer lineup for July and August Community Office Hours and Tech Talks. Scroll down to ...

Edge Processor Scaling, Energy & Manufacturing Use Cases, and More New Articles on ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Get More Out of Your Security Practice With a SIEM

Get More Out of Your Security Practice With a SIEMWednesday, July 31, 2024  |  11AM PT / 2PM ETREGISTER ...