Cross Referencing Queries

Hi, I’m fairly new to Grafana and have a question regarding queries and plugin development.

For my situation, I have two types of logs that are stored in my ELK stack. The first log records an action from a host to various servers and the result. The other log is generated from each server and simply states whether or not the server has network connection.My problem statement is that I need to query the action logs while filtering out any failed results that happened during a time that the target server was not active.

I have tried to work around this issue by duplicating and augmenting the code for the Table Panel Plugin (https://github.com/grafana/grafana/tree/master/public/app/plugins/panel/table) to accept and compare the two queries before displaying the filtered result. While this works for the Table Panel, I am reluctant to make a custom version of each Grafana plugin that uses the action query.

My question is, is it possible to recreate the Elasticsearch datasource plugin, and add my own backend logic so that this cross-referencing logic is done at the datasource level and not at the panel level?