A method for determining the amount of logs on a cutting and splitting machine comprising the steps: a) calibrating a distance meter to obtain an initial distance r 0, wherein initial distance r 0 represents the distance from the contactless distance meter to the base on which the log rests during the transition from the cutting to the splitting part of the machine, b) continuously performing distance measurements, a measurement cycle starting when a contactless distance meter measures a distance shorter than the initial distance r 0 and longer than the initial distance r 0 reduced by a predetermined tolerance distance r tol, c) capturing distance measurements at a predetermined time interval Δt, d) rounding the captured discrete values of the measured distance, e) comparing a predetermined number of consecutive rounded captured discrete values of the measured distance and excluding measurements if these values are not the same, f) comparing successively captured distance measurements at a predetermined time interval Δt without the measurements excluded in the previous step, excluding distance measurements that do not follow the pattern of the initial gradually shortening the measured distance and then lengthening the measured distance, g) storing the shortest measured distance r d, h) completing a measurement cycle when the contactless distance meter detects a distance between r 0 and r 0 -r tol, excluding all measurements measured within a predetermined time interval Δt z from the moment the contactless distance meter has detected the distance between r 0 and r 0 -r tol, i) calculating a volume of a log at each end of the measurement cycle according to the equation: V i = π r 0 − r d 2 2 l, where 1 is the displacement of a log in its longitudinal direction through the cutting part of the machine, j) calculating the total amount of logs by adding the contribution of the calculated volume of the log, k) optionally repeating the steps b) to j). a) calibrating a distance meter to obtain an initial distance r 0, wherein initial distance r 0 represents the distance from the contactless distance meter to the base on which the log rests during the transition from the cutting to the splitting part of the machine, b) continuously performing distance measurements, a measurement cycle starting when a contactless distance meter measures a distance shorter than the initial distance r 0 and longer than the initial distance r 0 reduced by a predetermined tolerance distance r tol, c) capturing distance measurements at a predetermined time interval Δt, d) rounding the captured discrete values of the measured distance, e) comparing a predetermined number of consecutive rounded captured discrete values of the measured distance and excluding measurements if these values are not the same, f) comparing successively captured distance measurements at a predetermined time interval Δt without the measurements excluded in the previous step, excluding distance measurements that do not follow the pattern of the initial gradually shortening the measured distance and then lengthening the measured distance, g) storing the shortest measured distance r d, h) completing a measurement cycle when the contactless distance meter detects a distance between r 0 and r 0 -r tol, excluding all measurements measured within a predetermined time interval Δt z from the moment the contactless distance meter has detected the distance between r 0 and r 0 -r tol, i) calculating a volume of a log at each end of the measurement cycle according to the equation: V i = π r 0 − r d 2 2 l, where 1 is the displacement of a log in its longitudinal direction through the cutting part of the machine, j) calculating the total amount of logs by adding the contribution of the calculated volume of the log, k) optionally repeating the steps b) to j).