Currently, there is an increasing interest in predicting the behavior of active work items in Business Process Management (BPM) systems, which would make possible to monitor the behavior of such processes in a more accurate way. Given the complexity of current business processes, conventional techniques are not always effective in addressing this type of requirements; therefore, machine learning techniques are being increasingly more used for this task. This work deals with the problem of fail detection in a BPM system from event logs, based on machine learning methods. The paper explores the use of three structural learning models, Hidden Markov Models (HMM), Hidden semi-Markov models (HSMM) and Non-stationary Hidden semi-Markov models (NHSMM). The experiments are carried out using a real database of about 460,000 event logs sequences. The results show that for the given dataset, fail detection can be achieved with an accuracy of 86.70% using the HSMM model. In order to reduce the computational load of the proposed approach, the models were implemented in a distributed processing environment using Apache Spark, which guarantees solution scalability.