Problem on send event to intake/v2/events

I'm using the events intake API to send logs to APM server and I'm receiving status 202.

My request:

curl -i -H "Authorization: Bearer mytoken" -H "Content-type: application/x-ndjson" --data-binary @logs.ndjson https://{hostname}:{ports}/intake/v2/events

My file @logs.ndjson content:

{"metadata":{"process":{"pid":1234,"title":"/usr/lib/jvm/java-10-openjdk-amd64/bin/java","ppid":1,"argv":["-v"]},"system":{"architecture":"amd64","detected_hostname":"8ec7ceb99074","configured_hostname":"host1","platform":"Linux","container":{"id":"8ec7ceb990749e79b37f6dc6cd3628633618d6ce412553a552a0fa6b69419ad8"},"kubernetes":{"namespace":"default","pod":{"uid":"b17f231da0ad128dc6c6c0b2e82f6f303d3893e3","name":"instrumented-java-service"},"node":{"name":"node-name"}}},"service":{"name":"poc-open-telemetry-nodejs","version":"1.0.0","node":{"configured_name":"8ec7ceb990749e79b37f6dc6cd3628633618d6ce412553a552a0fa6b69419ad4"},"environment":"development","language":{"name":"Java","version":"10.0.2"},"agent":{"version":"1.10.0","name":"java","ephemeral_id":"e71be9ac-93b0-44b9-a997-5638f6ccfc36"},"framework":{"name":"spring","version":"5.0.0"},"runtime":{"name":"Java","version":"10.0.2"}},"labels":{"group":"experimental","ab_testing":true,"segment":5}}}
{"error":{"id":"9876543210abcdeffedcba0123456780","timestamp":1710964392143,"trace_id":"0123456789abcdeffedcba0123456789","parent_id":"9632587410abcdef","transaction_id":"1234567890987654","transaction":{"sampled":true,"type":"request"},"culprit":"opbeans.controllers.DTInterceptor.preHandle(DTInterceptor.java:73)","log":{"message":"Request method 'POST' not supported","param_message":"Request method 'POST' /events/:event not supported","logger_name":"http404","level":"error","stacktrace":[{"abs_path":"/tmp/Socket.java","filename":"Socket.java","classname":"Request::Socket","function":"connect","vars":{"key":"value"},"pre_context":["line1","line2"],"context_line":"line3","library_frame":true,"lineno":3,"module":"java.net","colno":4,"post_context":["line4","line5"]},{"filename":"SimpleBufferingClientHttpRequest.java","lineno":102,"function":"executeInternal","abs_path":"/tmp/SimpleBufferingClientHttpRequest.java","vars":{"key":"value"}}]},"exception":{"message":"Theusernamerootisunknown","type":"java.net.UnknownHostException","handled":true,"module":"org.springframework.http.client","code":42,"handled":false,"attributes":{"foo":"bar"},"cause":[{"type":"InternalDbError","message":"something wrong writing a file","cause":[{"type":"VeryInternalDbError","message":"disk spinning way too fast"},{"type":"ConnectionError","message":"on top of it,internet doesn't work"}]}],"stacktrace":[{"abs_path":"/tmp/AbstractPlainSocketImpl.java","filename":"AbstractPlainSocketImpl.java","function":"connect","vars":{"key":"value"},"pre_context":["line1","line2"],"context_line":"3","library_frame":true,"lineno":3,"module":"java.net","colno":4,"post_context":["line4","line5"]},{"filename":"AbstractClientHttpRequest.java","lineno":102,"function":"execute","vars":{"key":"value"}}]},"context":{"request":{"socket":{"remote_address":"12.53.12.1","encrypted":true},"http_version":"1.1","method":"POST","url":{"protocol":"https:","full":"https://www.example.com/p/a/t/h?query=string#hash","hostname":"www.example.com","port":8080,"pathname":"/p/a/t/h","search":"?query=string","hash":"#hash","raw":"/p/a/t/h?query=string#hash"},"headers":{"Forwarded": "for=192.168.0.1", "host":"opbeans-java:3000","content-length":"0","cookie":["c1=v1","c2=v2"],"Elastic-Apm-Traceparent":"00-8c21b4b556467a0b17ae5da959b5f388-31301f1fb2998121-01"},"cookies":{"c1":"v1","c2":"v2"},"env":{"SERVER_SOFTWARE":"nginx","GATEWAY_INTERFACE":"CGI/1.1"},"body":"HelloWorld"},"response":{"status_code":200,"headers":{"content-type":"application/json"},"headers_sent":true,"finished":true},"user":{"id":99,"username":"foo","email":"user@foo.mail"},"tags":{"organization_uuid":"9f0e9d64-c185-4d21-a6f4-4673ed561ec8"},"custom":{"my_key":1,"some_other_value":"foobar","and_objects":{"foo":["bar","baz"]}},"service":{"name":"poc-open-telemetry-nodejs","node":{"configured_name":"node-xyz"},"language":{"version":"1.2"},"framework":{"version":"1","name":"Node"}}}}}

I get this payload example from: Example request body | Elastic Observability [8.12] | Elastic and change some information

The CURL returns:


(I can't put all return because of the information)

But after all that work I can't see this logs on my APM dashboard or seach on dataview of APM, can be some problem?

In the payload example I change the timestamp, some IDs and service.name

I have the same problem trying to send data to the APM server and receive a 202 response but can't see the data in ELK/APM. Do service names or some other component have to be configured on the server side for this data to be displayed?

My problems was the payload, the example on the documentation doesn't work for me.
But this example that I found in some question in this forum works:

{"metadata":{"process":{"pid":81772,"title":"/bin/dart","argv":["--enable-asserts"]},"system":{"architecture":"x86_64","detected_hostname":"joe.local","platform":"Darwin"},"service":{"name":"HyperWebinar API","agent":{"name":"GuaraciObserver","version":"0.0.1"},"environment":"development","language":{"name":"Dart","version":"2.10.5 (stable) (Tue Jan 19 13:05:37 2021 +0100) on \"macos_x64\""},"runtime":{"name":"Dart","version":"2.10.5 (stable) (Tue Jan 19 13:05:37 2021 +0100) on \"macos_x64\""}},"labels":{}}}
{"transaction":{"timestamp":1624500828575408,"duration":393,"name":"GraphQL query","type":"http","id":"103-1624500828575","trace_id":"104-1624500828575","parent_id":null,"span_count":{"started":2},"sampled":true,"sample_rate":1}}

Then when I search in APM data-view for:

service.name: "HyperWebinar API"

I found the logs. I hope that works for you

@Ingrid_Rauany Welcome to the community and thanks for posting your solution!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.