If you are using Logs and Events with Grail, a potential query could be:
| filter contains(content, "error1") and contains(content, "error2") and host.name == "host1" OR host.name == "host2"
You may need to modify the 'host.name' portion to be a different Dynatrace entity in order to match the applications you are referring to (i.e. dt.process.name if you have a process that runs on both applications, or dt.source.entity if you have the exact entity ID of each application).
Hope that helps!