We obtain a simple direct derivation of the differential equation governing the entropy flow probability distribution function of a stochastic system first obtained by Lebowitz and Spohn. We show that the solution of this equation satisfies the well known fluctuation relations for the entropy also for finite times. A trajectory sampling algorithm allowing to evaluate the entropy flow distribution function is introduced and discussed. The algorithm is successfully applied to an asymmetric simple exclusion process.