APM From file


So I have a PHP app, but it doesn't have access to my internal elasticsearch cluster.
I'm wondering how feasible it would be to do something like the following;

  1. Custom PHP agent in app writes events to file
  2. Custom agent (that does have access to elasticsearch/apm server) pulls in files from app, and pushes them to the apm server

Clearly not recommended, but could something like this work?

If not, does anyone have any suggestions on using APM with a web app that doesn't have access to the APM server?


I would like to understand the problem a bit better. First you say:

it doesn't have access to my internal elasticsearch cluster

And it doesn't need to, it just needs access to an apm server. But at the end you say:

a web app that doesn't have access to the APM server

In that case, how would your suggestion work? If you are writing events to a file, whichever process reads those files would need access to an apm server, right?

And out of curiosity, what is the underlying issue? A security policy? PHP threading limitations?

So the PHP app I want to monitor is a SaaS product, so I can't install the APM server there.

I can install the APM server on my internal boxes, however these are not accessible from the outside world (#security). They can however pull files in from the SaaS product.

So my theory is, take something like https://github.com/philkra/elastic-apm-php-agent, and change the Connector (ie the code that does the http requests to the APM server) so that instead of doing a http request to the APM server, it just writes the JSON to a file.

I then have a process on my internal boxes that pulls in that file, and fires off the JSON to the internal APM server

Ok, thanks for explaining.
I don't know what are your architecture's requirements and constraints, but generally it is possible to use apm server securely on a SaaS product.

That said, your suggestion can work in theory. Hope that helps!

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