creating statistics form the log database