Getting Data In

Cross-Domain requests when using RESTful API

liviu_trifoi
Engager

Hi guys.

I want to push error logs from a silverlight app to our splunk installation.
I'm using the splunk RESTful API and it works quite nicely (for non-web clients)

So I have a site: www.xxx.com. (Server 1)
And a splunk installation at: (Server 2).

Problem is I can't make web requests from www.xxx.com to Server 2, because of the same origin policy (See http://en.wikipedia.org/wiki/Same_origin_policy).

Silverlight allows such web requests if Server 2 has a clientaccesspolicy.xml or crossdomain.xml at the root of the request.

So the first thing silverlight does when I request https://server2:8089/services/receivers/simple
is request a clientaccesspolicy.xml from https://splunk_server2:8089/clientaccesspolicy.xml.

My question is: How can I make splunk return me an xml written by me when I call the https://splunk_server2:8089/clientaccesspolicy.xml url.

araitz
Splunk Employee
Splunk Employee

You won't be able to get splunkd to return a client access policy. I would recommend against using cross-domain requests. In fact, I don't see why a cross domain request is required at all for your web service to post to Splunk's REST API, but I might be misunderstanding your question.

araitz
Splunk Employee
Splunk Employee

That is the approach I would recommend, to build a proxy on the server rather than doing cross-domain requests. Well done!

0 Karma

liviu_trifoi
Engager

my web service is not posting data. I was trying to post err log data directly from the client's browser (e.g. javascript/flash/silverlight) to a splunk installation which is not on the same server as the web server.
But I do agree it's a bad idea, especially because username/pass is in clear text for the rest api.

I've solved my problem with a custom web page on my web server that receives log data on post parameters, and logs it to splunk using the REST api.

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...