Merging two log sources

I need to merge access.log with application.log based on equal timestamp +/- delta, thread name and request URI to get one event (instead two) saved into DB. Is it possible with logstach or I need some preprocessing before using logstash?

Have you looked at the collate filter?