Logstash count insta Filter aggregate

Hello,
I would to know the best way to have count_event as aggregate for task_id equal to field1.
I can create count as new event but notre like in the following format.

Field1, field2, field3, field4, count_event
 A,B, C, 1,2
A,D, E, 0,2
B, E, T, 1,2
B, R, H, 0,2
S, V, X, 1,1

Thanks