Reputation: 83
Writing first MQL query to achieve below:
Note: both logs have a common field flowExecutionId whose value remains same for each transaction.
fetch logging.googleapis.com/user/count_verify_country
| filter has(jsonPayload.requestBody.actors.client.verify.country)
| group_by [jsonPayload.requestBody.actors.client.daVinciFlow.flowExecutionId], [country: any(jsonPayload.requestBody.actors.client.verify.country)]
| join (
fetch logging.googleapis.com/user/verify_completed
| filter jsonPayload.requestBody.success.message == "Verify Completed"
| group_by [jsonPayload.requestBody.actors.client.daVinciFlow.flowExecutionId], [success_count: count_true()]
) on jsonPayload.requestBody.actors.client.daVinciFlow.flowExecutionId
| outer_join
| group_by [country], [total_success: sum(success_count)]```
Getting error: Line 5: Expected: ')'. Instead found: 'logging'.
Upvotes: 0
Views: 102
Reputation: 1012
You mentioned you want to count all occurrences of MESSAGE as SUCCESS. But you are giving “Verify Completed” when you are filtering the verify_completed logs. So try using the SUCCESS
in place of Verify Completed
at the line filter jsonPayload.requestBody.success.message == "SUCCESS"
and outer_join is not required.
fetch logging.googleapis.com/user/count_verify_country
| filter has(jsonPayload.requestBody.actors.client.verify.country)
| group_by [jsonPayload.requestBody.actors.client.daVinciFlow.flowExecutionId], [country: any(jsonPayload.requestBody.actors.client.verify.country)]
| join (
fetch logging.googleapis.com/user/verify_completed
| filter jsonPayload.requestBody.success.message == "SUCCESS"
| group_by [jsonPayload.requestBody.actors.client.daVinciFlow.flowExecutionId], [success_count: count()]
) on jsonPayload.requestBody.actors.client.daVinciFlow.flowExecutionId
| group_by [country], [total_success: sum(success_count)]
Refer to this official MQL example document for more information.
Upvotes: 0