  We consider the problem of stability and local energy decay for co-dimension
one perturbations of the soliton of the cubic Klein-Gordon equation in $1+1$
dimensions. Our main result gives a weighted time-averaged control of the local
energy over a time interval which is exponentially long in the size of the
initial (total) energy. More precisely, for well-prepared initial perturbations
on the center stable manifold that are of size $\delta$ in the energy norm, we
show that the local energy is under control up to times of the order
$\exp(c\delta^{-\beta})$ for any $\beta < 4/3$. A major difficulty is the
presence of a zero-energy resonance in the linearized operator, which is a
well-known obstruction to improved local decay properties.
  We address this issue by using virial estimates that are frequency-localized
in a time-dependent way and introducing a "singular virial functional" with
time-dependent weights to control the mass of the perturbation projected away
from small frequencies. The proof applies to more general models, yielding
analogous results for perturbations of the kink of the Sine-Gordon model, and
small solutions of nonlinear Klein-Gordon equations. In this respect, our
result is close to optimal due to the existence of wobbling kinks and breathers
in the Sine-Gordon model which violates our conclusion if $\beta = 2$. This
appears to be the first successful general attempt at using virial estimates in
the presence of a resonance to deduce local energy control.
