Query / Log Stream Matching
Asked at Datadog· Screen
Reported by the problem's creator, not verified
You process a stream of messages in order. Each message registers a query or is a log line, and each message produces zero or one output line.
Examples
Example 1
Input: livetail_stream =
["Q: database","Q: Stacktrace","Q: loading failed","L: Database service started","Q: snapshot loading","Q: fail","L: Started processing events","L: Loading main DB snapshot","L: Loading snapshot failed no stacktrace available"]Output:
["ACK: database; ID=1","ACK: Stacktrace; ID=2","ACK: loading failed; ID=3","M: Database service started; Q=1","ACK: snapshot loading; ID=4","ACK: fail; ID=5","M: Loading main DB snapshot; Q=4","M: Loading snapshot failed no stacktrace available; Q=2,3,4"]Explanation: Query 1 matches the first log line. The last line contains
stacktrace(query 2),loadingandfailed(query 3), andsnapshot(query 4); query 5 (fail) does not match becausefailedis a different whole word.Started processing eventsmatches no query, so it produces no output.