Getting Data In

I am using HTTP Event Collector to post data from my application to splunk and has issues with it.

deepu1107
New Member

I am using HTTP Event Collector to post data from my application to splunk and was able to successfully post the simple json string but in case of complex json string I am getting an error saying 400 bad request. I have given my data in the description section
I am able to post the below string successfully
{
"event: Abcdef, Y10EE888, EEE"
}

but I am getting the error with the below Json String
{
"Student":{
"FirstName":"Abc",
"LastName":"Def",
"FlashID":"12345",
"FlashEmailID":"abc@def.com",
"StudentDegreeofEnrollment":"MS",
"StudentCourses":[
{
"CourseID":"101",
"CourseName":"SEM"
}
],
"StudentMajor":"EE"
}
}

I am passing Authorization value and content type (application/json) in HTTP request headers. I am not able to figure out why the request was failing with 400 Bad request even the Json string is properly formatted. Any help on this is appreciated.

Thanks

Tags (1)
0 Karma

FrankVl
Ultra Champion

That's because splunk expects the outer layer of JSON to look like this:

{
 ...
 "event": "..."
 ...
}

So you need to nest your actual JSON string inside the event field. See also: http://docs.splunk.com/Documentation/Splunk/latest/Data/FormatEventsforHTTPEventCollector#Examples

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...