How calculate time différence between two rows in csv file?

How did you add the taskStarted and taskEnded tags to the events? Something like this?...

if [ent_sort] == "sortie" { mutate { add_tag => [ "taskEnded" ] } }