We developed an IVR for a client that has a custom data action to check the number of agents logged in a queue with certain statuses. It's working fine.
Very rarely, we've experimented calls going to the queue without any agent logged and checking the conversation log we can see it is not a data action timeout case, but a data action failure.
How can I find logs or something that could help me to investigate the reason of this failures?
You can't get the logs, you have to open a case with support to look at them for you.
One thing you could do is make sure you add variables to the Failure Outputs section of your data action. In the Failure path, add a Set Participant Data action and write out the values of the failure variables. Later to debug a call, use the api to fetch the conversation using the /conversations/id endpoint. The failure values will be in an attributes section one of of the participants.