Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Posting Events to insights-collector.newrelic.com not working

insights
api
insightsapi

#1

Hello.
I am currently trying to post an event to the insights api at https://insights-collector.newrelic.com. My problem is that I am not able to query for it in insights. It seems like the event is not posting correctly. When I run a curl command locally i get a return value of {}%. My guess is that its an issue with my account_id/key but I’m not sure how I confirm that. Here is the curl command I’m running:

curl --data ‘{“eventType” : “Alert”, “message” : “This is an Alert!”}’
–request POST
–header “Content-Type: application/json”
–header “X-Insert-Key: MY_KEY”
https://insights-collector.newrelic.com/v1/accounts/1721442/events

Any help on figuring this out would be great.

Thanks!
Roger


#2

Run this in insights:

SHOW EVENT TYPES SINCE 1 day ago

Not entirely sure you have that curl statement correct. It’s hard to tell because this forum software sometimes alters the text.

curl -XPOST -H 'X-Insert-Key: foo' -H "Content-type: application/json" -d '{“eventType” : “Alert”, “message” : “This is an Alert!”}' 'https://insights-collector.newrelic.com/v1/accounts/1721442/events'


#3

The query works and gives me a list of our event types. The curl command returns the same empty response {}%.

Thanks!


#4

Does it show the “Alert” event type?

What NRQL query are you using to find your alert event?

You are using an insert API key?

You are using a paid account?

You can see any other custom event types?


#5

Hey @roger.link - I think @6MM may be right here about the event type being missing. I just ran the SHOW EVENT TYPES SINCE 1 week ago query in your account and I’m not seeing any event named Alert.

Can you double check your insert key and the CURL command you are using to push that data in?


#6

So there won’t be any Alert Types showing up because they are new, or rather, I’m trying to set them up by posting them. Is there something that has to be done, to onboard a new type other than post it? I’ve tried @6MM 's curl command and got the same results. At this point I’m guessing its the the key privileges. I will follow up on that and report back. Thank you for your help!


#7

Hi @roger.link - The documentation explains how to generate an Insights key


#8

Hey @roger.link I just ran a test with the Event Insert API on my own account and I see that it worked fine for me. My CURL command is below, copied exactly from the Insights API Insert Key UI.

gzip -c example_events.json | curl --data-binary @- -X POST -H "Content-Type: application/json" -H "X-Insert-Key: CNGIWTii5MvU8MSGOK4Yqis0ZotmNEvK" -H "Content-Encoding: gzip" https://insights-collector.newrelic.com/v1/accounts/XXXXX/events

(This API key has now been deleted, PLEASE DO NOT share API keys here in the Explorers Hub.)

Could you run a test with the same CURL command as you can find in the Insert API key page? (The URL will be something like: https://insights.newrelic.com/accounts/XXXXXX/manage/api_keys/insert/XXXXX


#9

I’d double check you have a pro subscription.


#10

@6MM - I confirmed that the account ID listed here by @roger.link does have a subscription supporting custom events. :slight_smile:


#11

The issue was that the key I was using was incorrect. I don’t have access to the generation or update of these keys. I had someone create a new one and it worked. Thanks everyone for your help.


#12

Fantastic! Thanks for letting us know you got this sorted out @roger.link :slight_smile: