Is it possible to get a history of when a cluster failed over and which node became the active node?
2 Answers
Is it possible to get a history of when a cluster failed over and which node became the active node?
That depends on how your define "history". There will be, in the cluster log, system log, and potentially sprinkled in other logs depending on a few things, the events that show a failover has occurred. For example, in the event logs you might search for event 1069 which would tell you that a resource failed in the cluster.
However, logs don't go back until the beginning of time. So if it's extremely recent history you're after then you might be ok. If you're looking at since inception, the answer is, nope you can't if you weren't already capturing this data.
Extended note: It also depends on how you define failover, as per manual or automatic. Additionally if you have the SQL Server engine errorlog, you can parse it to find when the node name is not the same after startup (FCI failover) or the line items for role synchronization changes (AG).
Just run the code below in PowerShell. It will generate a failover history for you. It works for both AG name and Cluster name if it is not an AG.
Get-winEvent -ComputerName AGorClusterName -filterHashTable @{logname ='Microsoft-Windows-FailoverClustering/Operational'; id=1641}| ft -AutoSize -Wrap
-
Excellent, Windows Events Log certainly provides the AG/Cluster failover activities. Thanks. Commented Oct 27, 2022 at 10:14
AvailabilityGroups
orFCI
?