The filter you are looking for is save_post
. This filter is triggered each time you save a post.
add_action( 'save_post', 'my_function' );
function my_function( $post_id ){
// Do your stuff here
}
This filter passes the post’s ID to the callback function, so you have access to everything you need.