Joining queries from multiple data sources

I have consistent logs coming in from Azure Log Analytics, and I have relevant metadata stored in MySQL. I am aware of mixed queries, but these seem to be only for displaying the data alongside eachother, and don’t allow for any interaction.
Here’s an example scenario:
Display logs (Azure) only for users that have an email address set (value stored in MySQL). Both datasources contain a relevant UserId, so I’m basically looking to join the MySQL data where email != null on UserId.

Is this possible within the scope for Grafana? I was looking into the “-- Dashboard --” datasource option, which makes me think I could hack something together by creating a Mixed Query panel that projects all the data that I need, and then I could manipulate that data in the Dashboard datasource panel. I’m having trouble finding documentation on both the Dashboard and Mixed Query datasources, and I’m having trouble throwing something together myself.

Thanks for any and all support!

I might actually be able to solve this by using a Variable that pulls from the MySQL database. Still open to other ideas, though!

Was actually able to solve this using variables. In line with the earlier example, one SQL query variable that returns every not-null email address entry, and then a Kusto panel that references the list returned by that variable. Also learned that you can reference one variable in another variable, which is great for another use-case I had in mind. Anyways someone can close this topic unless there is a better solution that one would like to share.

Hi dwightdl

I think that a option is a new feature of grafana 7, called Transformations that allows doing outer join of multiples queries based on a field

1 Like

Thanks for the response- I haven’t had a change to play around with Transformations but I will certainly look into it! Only recently upgraded to 7 :slight_smile:

I use template variables to implement my business requirement too!thanks a lot ^~^

1 Like

While creating graph you can select “–Mixed–” datasource and add multiple queries. You get option to select different sub-datasource for each query.
This solution worked for me like a charm. :slight_smile:


That is the best solution. Grafana allows use two diferent datasources using “Mixed Datasource”

1 Like