You are looking at documentation for a beta release.
Generated Documents
editGenerated Documents
editThe APM Server produces documents with a specific structure. The defined structure can be used to create an index in Elasticsearch. See the examples in this section for different document types.
Examples
editIn the following you find example documents sent to Elasticsearch from APM Server:
Transaction document
edit{ "context": { "app": { "agent": { "name": "elastic-node", "version": "3.14.0" }, "argv": [ "node", "server.js" ], "framework": { "name": "Express", "version": "1.2.3" }, "language": { "name": "ecmascript", "version": "8" }, "name": "1234_app-12a3", "pid": 1234, "process_title": "node", "runtime": { "name": "node", "version": "8.0.0" }, "version": "5.1.3" }, "custom": { "and_objects": { "foo": [ "bar", "baz" ] }, "my_key": 1, "some_other_value": "foo bar" }, "request": { "body": "Hello World", "cookies": { "c1": "v1", "c2": "v2" }, "env": { "GATEWAY_INTERFACE": "CGI/1.1", "SERVER_SOFTWARE": "nginx" }, "headers": { "array": [ "foo", "bar", "baz" ], "content-type": "text/html", "cookie": "c1=v1; c2=v2", "some-other-header": "foo", "user-agent": "Mozilla Chrome Edge" }, "http_version": "1.1", "method": "POST", "socket": { "encrypted": true, "remote_address": "12.53.12.1" }, "url": { "hash": "#hash", "hostname": "www.example.com", "pathname": "/p/a/t/h", "port": "8080", "protocol": "https:", "raw": "/p/a/t/h?query=string#hash", "search": "?query=string" } }, "response": { "finished": true, "headers": { "content-type": "application/json" }, "headers_sent": true, "status_code": 200 }, "system": { "architecture": "x64", "hostname": "prod1.example.com", "platform": "darwin" }, "tags": { "organization_uuid": "9f0e9d64-c185-4d21-a6f4-4673ed561ec8" }, "user": { "email": "foo@example.com", "id": "99", "username": "foo" } }, "processor": { "event": "transaction", "name": "transaction" }, "transaction": { "duration": { "us": 32592 }, "id": "945254c5-67a5-417e-8a4e-aa29efcbfb79", "name": "GET /api/types", "result": "success", "type": "request" } }
Trace document
edit{ "context": { "app": { "agent": { "name": "elastic-node", "version": "3.14.0" }, "name": "1234_app-12a3" }, "db": { "instance": "customers", "statement": "SELECT * FROM product_types WHERE user_id=?", "type": "sql", "user": "readonly_user" } }, "processor": { "event": "trace", "name": "transaction" }, "trace": { "duration": { "us": 3781 }, "id": 0, "name": "SELECT FROM product_types", "stacktrace": [ { "abs_path": "net.js", "context": { "post": [ " ins.currentTransaction = prev", " return result", "}" ], "pre": [ " var trans = this.currentTransaction", "" ] }, "filename": "net.js", "function": "onread", "in_app": false, "line": { "column": 4, "context": "line3", "number": 547 }, "module": "some module", "vars": { "key": "value" } }, { "filename": "my2file.js", "line": { "number": 10 } } ], "start": { "us": 2830 }, "transaction_id": "945254c5-67a5-417e-8a4e-aa29efcbfb79", "type": "db.postgresql.query" } }
Error document
edit{ "context": { "app": { "agent": { "name": "elastic-node", "version": "3.14.0" }, "argv": [ "node", "server.js" ], "framework": { "name": "Express", "version": "1.2.3" }, "language": { "name": "ecmascript", "version": "8" }, "name": "1234_app-12a3", "pid": 1234, "process_title": "node", "runtime": { "name": "node", "version": "8.0.0" }, "version": "5.1.3" }, "custom": { "and_objects": { "foo": [ "bar", "baz" ] }, "my_key": 1, "some_other_value": "foo bar" }, "request": { "body": "Hello World", "cookies": { "c1": "v1", "c2": "v2" }, "env": { "GATEWAY_INTERFACE": "CGI/1.1", "SERVER_SOFTWARE": "nginx" }, "headers": { "array": [ "foo", "bar", "baz" ], "content-type": "text/html", "cookie": "c1=v1; c2=v2", "some-other-header": "foo", "user-agent": "Mozilla Chrome Edge" }, "http_version": "1.1", "method": "POST", "socket": { "encrypted": true, "remote_address": "12.53.12.1" }, "url": { "hash": "#hash", "hostname": "www.example.com", "pathname": "/p/a/t/h", "port": "8080", "protocol": "https:", "raw": "/p/a/t/h?query=string#hash", "search": "?query=string" } }, "response": { "finished": true, "headers": { "content-type": "application/json" }, "headers_sent": true, "status_code": 200 }, "system": { "architecture": "x64", "hostname": "prod1.example.com", "platform": "darwin" }, "tags": { "organization_uuid": "9f0e9d64-c185-4d21-a6f4-4673ed561ec8" }, "user": { "email": "foo@example.com", "id": 99, "username": "foo" } }, "error": { "culprit": "my.module.function_name", "exception": { "attributes": { "foo": "bar" }, "code": "42", "message": "The username root is unknown", "module": "__builtins__", "stacktrace": [ { "abs_path": "/real/file/name.py", "context": { "post": [ "line4", "line5" ], "pre": [ "line1", "line2" ] }, "filename": "file/name.py", "function": "foo", "in_app": false, "line": { "column": 4, "context": "line3", "number": 3 }, "module": "App::MyModule", "vars": { "key": "value" } }, { "abs_path": "/Users/watson/code/node_modules/elastic/lib/instrumentation/index.js", "context": { "post": [ " ins.currentTransaction = prev", " return result", "}", "}", "", "Instrumentation.prototype._recoverTransaction = function (trans) {", " if (this.currentTransaction === trans) return" ], "pre": [ " var trans = this.currentTransaction", "", " return instrumented", "", " function instrumented () {", " var prev = ins.currentTransaction", " ins.currentTransaction = trans" ] }, "filename": "lib/instrumentation/index.js", "function": "instrumented", "in_app": false, "line": { "context": " var result = original.apply(this, arguments)", "number": 102 }, "vars": { "key": "value" } } ], "type": "DbError", "uncaught": true }, "grouping_key": "4cfd552c0f4a291894c3558466f92151", "id": "9f0e9d64-c185-4d21-a6f4-4673ed561ec8", "log": { "level": "warning", "logger_name": "my.logger.name", "message": "My app could not talk to the database named foobar", "param_message": "My app could not talk to the database named %s", "stacktrace": [ { "abs_path": "/real/file/name.py", "context": { "post": [ "line4", "line5" ], "pre": [ "line1", "line2" ] }, "filename": "file/name.py", "function": "foo", "in_app": false, "line": { "column": 4, "context": "line3", "number": 3 }, "module": "App::MyModule", "vars": { "key": "value" } }, { "abs_path": "/Users/watson/code/node_modules/elastic/lib/instrumentation/index.js", "context": { "post": [ " ins.currentTransaction = prev", " return result", "}", "}", "", "Instrumentation.prototype._recoverTransaction = function (trans) {", " if (this.currentTransaction === trans) return" ], "pre": [ " var trans = this.currentTransaction", "", " return instrumented", "", " function instrumented () {", " var prev = ins.currentTransaction", " ins.currentTransaction = trans" ] }, "filename": "lib/instrumentation/index.js", "function": "instrumented", "in_app": false, "line": { "context": " var result = original.apply(this, arguments)", "number": 102 }, "vars": { "key": "value" } } ] } }, "processor": { "event": "error", "name": "error" } }