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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

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