Kibana version:
v 8.2.2
Elasticsearch version:
v 8.2.2
APM Server version:
v 8.2.2
APM Agent language and version:
Python 3.10.0
Browser version:
Google Chrome
Version 102.0.5005.63 (Official Build) (64-bit)
Original install method (e.g. download page, yum, deb, from source, etc.) and version:
Kibana and Elasticsearch are installed as docker containers
Fresh install or upgraded from other version?
Fresh install
Is there anything special in your setup?
No, I only followed the official documentation:
- Quick start | Elasticsearch Guide [8.2] | Elastic
- Add a Fleet Server | Fleet and Elastic Agent Guide [8.2] | Elastic
- Install Fleet-managed Elastic Agents | Fleet and Elastic Agent Guide [8.2] | Elastic
- Starlette/FastAPI Support | APM Python Agent Reference [6.x] | Elastic
Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
I'm trying to integrate my FastAPI server with ELK to be able to see server logs here http://localhost:5601/app/discover#/
I managed to find this instruction: Starlette/FastAPI Support | APM Python Agent Reference [6.x] | Elastic
But it never worked due to this error:
(venv) PS C:\PythonProjects\Fastapi> uvicorn mainfastapi:app --reload --port 80
INFO: Will watch for changes in these directories: ['C:\\PythonProjects\\Fastapi']
INFO: Uvicorn running on http://127.0.0.1:80 (Press CTRL+C to quit)
INFO: Started reloader process [20476] using statreload
WARNING: The --reload flag should not be used in production on Windows.
2022-06-06 00:30:38,906 - INFO - elastic_transport.transport - _transport:perform_request:336 - POST https://localhost:9200/my_index/_doc [status:201 duration:0.053s] # < -- as you can see I can send singe entries to ELK
2022-06-06 00:31:07,712 - WARNING - elasticapm.transport.http - http:fetch_server_info:202 - HTTP error while fetching server information: HTTPConnectionPool(host='localhost', port=8200): Max retries exceeded with url: / (Ca
used by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000244F28797E0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
but generally it doesn't work, probably that's the first issue,
So I decided to try another solution: I installed Fleet on elastic and I'm trying to add an agent on my local machine, but I always end up with the following error:
and it seems
fleet agent can't connect to fleet server and I can't understand why...
I have set the following settings on Server hosts page:
PS C:\Users\ilia1\Desktop\elastic-agent-8.2.2-windows-x86_64> .\elastic-agent.exe install `
>> --fleet-server-es=https://172.18.0.2:9200 `
>> --fleet-server-service-token=token `
>> --fleet-server-policy=fleet-server-policy `
>> --fleet-server-es-ca-trusted-fingerprint=fingerprint
Elastic Agent will be installed at C:\Program Files\Elastic\Agent and will run as a service. Do you want to continue? [Y/n]:Y
{"log.level":"info","@timestamp":"2022-06-05T23:06:57.412+0300","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":393},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-06-05T23:06:59.699+0300","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":750},"message":"Waiting for Elastic Agent to start Fleet Server","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-06-05T23:07:29.734+0300","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":783},"message":"Fleet Server - Error - dial tcp 172.18.0.2:9200: i/o timeout","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-06-05T23:08:01.750+0300","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":783},"message":"Fleet Server - Starting","ecs.version":"1.6.0"}
Error: fleet-server failed: context canceled
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.2/fleet-troubleshooting.html
Error: enroll command failed with exit code: 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.2/fleet-troubleshooting.html
In Fleet agent logs:
{"log.level":"info","@timestamp":"2022-06-05T23:08:42.449+0300","log.origin":{"file.name":"log/reporter.go","file.line":40},"message":"2022-06-05T23:08:42+03:00 - message: Application: fleet-server--8.2.2[]: State changed to STARTING: Starting - type: 'STATE' - sub_type: 'STARTING'","ecs.version":"1.6.0"}
{"log.level":"error","@timestamp":"2022-06-05T23:08:52.680+0300","log.origin":{"file.name":"status/reporter.go","file.line":236},"message":"Elastic Agent status changed to: 'error'","ecs.version":"1.6.0"}
{"log.level":"error","@timestamp":"2022-06-05T23:08:52.680+0300","log.origin":{"file.name":"log/reporter.go","file.line":36},"message":"2022-06-05T23:08:52+03:00 - message: Application: fleet-server--8.2.2[]: State changed to FAILED: Error - dial tcp 172.18.0.2:9200: i/o timeout - type: 'ERROR' - sub_type: 'FAILED'","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2022-06-05T23:08:54.734+0300","log.origin":{"file.name":"status/reporter.go","file.line":236},"message":"Elastic Agent status changed to: 'online'","ecs.version":"1.6.0"}
Can you please help understand why I keep getting this error?