typhonius / acquia-logstream

PHP library to connect to Acquia Logstream service
MIT License
3 stars 4 forks source link

Use list-available command to query available log sources #143

Open danepowell opened 2 years ago

danepowell commented 2 years ago

Right now the list of available log sources to filter is hardcoded: https://github.com/typhonius/acquia-logstream/blob/e6db05627610eea3f110334cb6542babeab2364e/src/LogstreamCommand.php#L38

This isn't very future-proof in case log sources change. Additionally, it's possible that not all servers support all log sources.

The logstream API supports a list-available command that could be used to get available log sources instead: https://github.com/acquia/logstream#list-available-inbound

typhonius commented 2 years ago

I had a play with this today and it doesn't do what we expect it to do. It only works once stream-environment has run for a little bit and connected all the servers up. This is also a pain as you're in an event loop and don't know when to trigger it to close because you're awaiting messages from an unknown number of servers and log files.

If you run list-available in any other context, it only provides the logstream server as available. There might be another hidden websocket server command that can do what we want, but I think the easiest way would be to query the main API itself for logs and then use that as part of a list command: