Splunk Dev

Get events into splunk using Javascript SDK - Internet Explorer 8

yitzarad
Path Finder

Hi,

I'm trying to send data into splunk index, using splunkjs.Service.Index.submitEvent method, as shown in the example (look for "To add data directly to an index" paragraph). It works fine under FF and Chrome, but not in IE8.

When trying to execute myindexes.item("test_index"), the myindexes is null. I verified that it is OK and non-null before the fetch callback is executed.

In the console, I see an error saying "Error in parsing JSON", without any additional data/params.

Any ideas?


Edit:

I have no IE8 to reproduce it right now. When running in IE10 everything is working fine (like FF and Chrome). But, when choosing compatibility view (which simulates IE7), the problem does occur. This can be reproduced easily, no specific configuration is required.

the code is very simple (almost purely copied from the example):


var http = new splunkjs.ProxyHttp("/proxy");

// Create a Service instance and log in
var service = new splunkjs.Service(http, {
username: "admin",
password: "changeme",
scheme: "https",
host: "localhost",
port:"8089",
version:"5.0"
});

// Get the collection of indexes
var myindexes = service.indexes();
// Get an index to send events to
myindexes.fetch(function(err, myindexes) {
var myindex = myindexes.item("main");
// Submit an event to the index
myindex.submitEvent("A new event", {
sourcetype: "mysourcetype"
}, function(err, result, myindex) {
console.log("Submitted event: ", result);
});
});

The normal network traffic goes like this ("output_mode=json" is omitted for readability):


(1) POST /proxy/services/auth/login
request body contains username and password
response contains a sessionKey

(2) GET /proxy/services/data/indexes?count=0
response contains a list of indexes details

(3) POST /proxy/services/receivers/simple?sourcetype=mysourcetype&index=main
request body contains the text of the event to be indexed
response contains a confirmation about the indexed event

When fails, the network traffic stops after the first request. the response seems to be alright: {"sessionKey":"................................"}

Get Updates on the Splunk Community!

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

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

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...

4 Ways the Splunk Community Helps You Prepare for .conf25

.conf25 is right around the corner, and whether you’re a first-time attendee or a seasoned Splunker, the ...