I am trying to sending an email alert if any action in my oozie workflow fails. How do I get which action got failed or is there any way to see the last successful action name in the workflow DAG?
There's no direct way to get last "successful" action AFAIK. If you think about it outside specific context for a moment: it's not easy to define "success" considering fork/join, control nodes, etc.
However, once criteria is defined, I guess it's possible to find last "successful" node using Oozie's REST API. For example, the response of workflow ($OOZIE_URL/v1/job/job_id?show=info) returns a list of actions within workflow. Actions are linked with "transition" field: last action's transition is null, other nodes' transition is their downstream node, etc.
Good luck and let us know if it works.