Log when ticket is moved to a different department

Log when ticket is moved to a different department

Hello, is there a way that I am able to log when and who moved a ticket from one department to another? I tried looking at workflows and I can't find any way to log a history when a ticket's department is changed.
It would be great if this data could also be seen when departments are changed using API calls