17 Jan 2024 04:57 PM
Hi dear community members,
I was very happy to see this feature coming with OA 1.269 (https://docs.dynatrace.com/docs/shortlink/release-notes-oneagent-sprint-269#enabled-event-ingest-on-...).
It took a while for me to test it, so I ended up testing it on trial SaaS Dynatrace environment after enabling it on environment level (Settings >> Extension Execution Controller >> Enable local HTTP Metric, Logs and Events Ingest API).
However, it works just 50%:
- I can inject metrics
- I get forbidden then I try it for events
I use VSC for injection.
Working request:
Answer:
HTTP/1.1 202 Accepted Content-Type: application/json Server: EEC Connection: close Content-Length: 62
{ "error": null, "linesOk": 1, "linesInvalid": 0 }
Failing request:
Answer:
HTTP/1.1 403 Forbidden Content-Type: text/plain Server: EEC Connection: close Content-Length: 9 Forbidden
any idea? Has anybody manage to make it work? I was unable to find any documentation for this in DT docs...
Thanks in advance!
Ingrida
Solved! Go to Solution.
17 Jan 2024 06:15 PM
Hey @ingridat ,
the API is exactly the same as with Events v2 API. I believe you have the endpoint incorrect, it should be /v2/events/ingest
Here is a more complex example using curl:
curl http://localhost:14499/v2/events/ingest -XPOST -d '{ "eventType": "CUSTOM_INFO", "title": "Loadtest start", "timeout": 30, "entitySelector": "type(HOST),entityName.equals(myhost)", "properties": { "Tool": "MyLoadTool", "Load per minute": "100", "Load pattern": "production" } }' -H "Content-Type: application/json; charset=utf-8" -v
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 14499 (#0)
> POST /v2/events/ingest HTTP/1.1
> Host: localhost:14499
> User-Agent: curl/7.64.0
> Accept: */*
> Content-Type: application/json; charset=utf-8
> Content-Length: 226
>
* upload completely sent off: 226 out of 226 bytes
< HTTP/1.1 201 Created
< Content-Type: application/json
< Server: EEC
< Content-Length: 2
<
* Connection #0 to host localhost left intact