Does it’s possible get this behavior:
If “message” match id2 regexp add for current stream id2 label (what actually is done) and for each subsequent stream add id2 label according value of id label?
I know, i can reach that using two queries, first to retrieve id using known data, and second with stream selector using id label. But, some software supports only one “harcoded” query, which doesn’t get all log lines. For example, data which known for some software is “522430890385b4e81f1000d6289ef675” line:
logQL {job=some-app} |~ "522430890385b4e81f1000d6289ef675"
but purpose is get all log lines with id eq “01e8” (with one query =))).
I don’t think it’s possible with promtail (or any log agent for that matter, without at least some sort of custom script).
However, sounds like you are confident that the logs between two IDs denoted by ---<ID>--- will always belong together, perhaps try to use multiline configuration and group all logs from the same ID into one? provided you don’t have too many log lines inbetween, of course.