0

I have a configuration as follows:

  1. Single elastic node (separate from the rest)
  2. Kibana setup on a separate node
  3. APM server on it's own node
  4. Flask Application set up on an it's own node.

Versions: Kibana and Elastic (opendistro): v 7.10.2 APM OSS: apm-server-oss-7.12.1-amd64.deb

Essentially I have instrumented my python flask app to push data to APM server but when I try to ingest data from APM in Kibana, I get

  1. APM Server response: You have correctly setup APM Server
  2. Agent status: No data has been received from agents yet

My Python flask app has the following structure

import sqlite3, requests, time, logging
from flask import Flask, jsonify
from elasticapm.contrib.flask import ElasticAPM
from elasticapm.handlers.logging import LoggingHandler

app = Flask(__name__)
apm = ElasticAPM(app, server_url='http://apm-oss.site:8200', service_name='APM-TEST-APP', logging=False)

@app.route('/')
def index():
    return jsonify({"message": "response ok"})

if __name__ == '__main__':
app.run(host='0.0.0.0', port=80)

My APM server has the following config

apm-server:
  host: "0.0.0.0:8200"

output.elasticsearch:
  hosts: ["https://esnode.site:9200"]
  ssl.certificate_authorities: ["/etc/apm-server/pki/root-ca.pem"]
  ssl.certificate: "/etc/apm-server/pki/client.pem"
  ssl.key: "/etc/apm-server/pki/client-key.pem"
  enabled: true

kibana:
  enabled: true
  host: "192.168.56.112:5601"
  username: "admin"
  password: "admin"

When I perform a curl against the python flask endpoint against port 80 I get the response below

Jun  1 15:30:58 app python3.6[24523]: 192.168.56.115 - - [01/Jun/2021 15:30:58] "#033[37mGET / HTTP/1.1#033[0m" 200 -
Jun  1 15:30:59 app python3.6[24523]: 192.168.56.115 - - [01/Jun/2021 15:30:59] "#033[37mGET / HTTP/1.1#033[0m" 200 -

Looking at the APM syslog, the following entries coincide with the previous curl commands which seem to be processing the incoming logs from the app server

Jun  1 15:49:03 apm-oss apm-server[7064]: {"log.level":"info","@timestamp":"2021-06-01T15:49:03.272Z","log.logger":"request","log.origin":{"file.name":"middleware/log_middleware.go","file.line":63},"message":"request accepted","url.original":"/intake/v2/events","http.request.method":"POST","user_agent.original":"elasticapm-python/6.1.3","source.address":"192.168.56.114","http.request.body.bytes":450,"http.request.id":"dcdc7497-de2a-41fc-8fd9-03c06949fd8f","event.duration":305562,"http.response.status_code":202,"ecs.version":"1.6.0"}

It does appear that the APM instance is receiving data but Kibana is saying no agents are up.

Anyone seen this and resolved it. Suggestions greatly appreciated.

ribbit
  • 79
  • 2
  • 13

0 Answers0