We study the statistics of heat transferred in a given time interval tM , through a finite harmonic chain, called the center (C), which is connected with two heat baths, the left (L) and the right (R), that are maintained at two different temperatures. The center atoms are driven by an external time-dependent force. We calculate the cumulant generating function (CGF) for the heat transferred out of the left lead, QL, based on two-time measurement concept and using nonequilibrium Green's function (NEGF) method. The CGF can be concisely expressed in terms of Green's functions of the center and an argument-shifted self-energy of the lead. The expression of CGF is valid in both transient and steady state regimes. We consider three different initial conditions for the density operator and show numerically, for one-dimensional (1D) linear chains, how transient behavior differs from each other but finally approaches the same steady state, independent of the initial distributions. We also derive the CGF for the joint probability distribution P (QL, QR), and discuss the correlations between QL and QR. We calculate the total entropy flow to the reservoirs. In the steady state we explicitly show that the CGF obeys steady state fluctuation theorem (SSFT). Classical results are obtained by taking → 0. The method is also applied to the counting of the electron number and electron energy, for which the associated self-energy is obtained from the usual lead self-energy by multiplying a phase or shifting the contour time, respectively.