diff --git a/src/stream.c b/src/stream.c index 40f9f75ae..0afa3059f 100644 --- a/src/stream.c +++ b/src/stream.c @@ -3102,6 +3102,9 @@ struct ist stream_generate_unique_id(struct stream *strm, struct lf_expr *format if ((unique_id = pool_alloc(pool_head_uniqueid)) == NULL) return IST_NULL; + /* Initialize ->unique_id to an empty string to prevent infinite + * recursion when the references %[unique-id] or %ID. + */ strm->unique_id = ist2(unique_id, 0); strm->unique_id.len = build_logline(strm, unique_id, UNIQUEID_LEN, format);