Hello splunkers, i'm gonna try to be short, I'm trying to create an HTML homepage for Splunk APP and I've been trying to get some information through a lookup without splunkJS or any splunk code (i'm doing this because splunk is spoiling my CSS pages and I need to customize this page view and customize either the way I handle this lookup data).
OBS.: I have my JS and lookup in the same app, I tried to do something like this:
$.ajax({
url: '../../../../lookups/ccm_links.csv',
dataType: 'text',
}).done(successFunction);
Way too few details for me to help here. I know you were being short...
So I see you’re working with Ajax. What is your preferred language to do this in? php, js, whatever?
What are you doing with the lookup once you have it? Writing,
Reading, Parsing, etc.?
Sorry for missing information.
1) I preferred js, but I can work with everything and I'm just using AJAX because it worked when I was testing on my computer but when I tried to do the same on server it didn't got the same result.
2) I'll read this information and split it up depending to the categories I'll determinate (using REGEX or a simple string comparison).
I'm just having some trouble while i'm trying to get lookup's data from splunk's folder.
EX: Lookups path : MYDISK:\Splunk\etc\apps\(APP_NAME)\lookups
My script path: MYDISK:\Splunk\etc\apps\(APP_NAME)\appserver\static
Thanks for your help.
Would this help?
var loc = window.location.pathname;
var dir = loc.substring(0, loc.lastIndexOf('/'));
first uses js to find the current working directory the other is just a way to grab the last directory name in the current working directory.
What I would do is print the first var and see what it says. Then I would use the same method you have with the ../../../ etc to get back to the apps main directory and into the lookups folder and file.
Be sure to check permissions and that the user running your js UI has permissions on that lookup file.
Also check your logs to see
If there are any permissions errors, file not found, etc
This article seems relevant
https://stackoverflow.com/questions/12250065/receive-csv-file-as-data-in-ajax-success-function