That won't work... I think you can use that to insert every time. Just remove the if statement.
Then set up a failed redirect in your login that passes a url parameter. You can then apply a second insert based on the existence of the url parameter that inserts the failed log. You could also apply the delete record server behavior to delete the success record that was inserted. Just make sure to manually move around the code so that the order is:
1) insert success log, save id in session as "login" using the login button press trigger
2) delete the record with the id = $_SESSION['login'] using the url parameter for failed login as a trigger
3) insert failure log using the url for failed login as a trigger
4) user login code