Zeta function for curves in a manifold Motivation
In the analogy between prime numbers and knots, the prime number is thought sometimes as the circle of length $l([p]) = \text{log}\,p$. This is so you can express the zeta function as 
$$ \zeta(s) = \sum_{D\ge0} e^{-l(D)s}$$
where the sum goes over effective divisors on $\text{Spec}\,\mathbb Z$ and length is extended there by additivity. Similarly, you can do it to rewrite Dedekind zeta function for other number fields.
Question
I wonder, what is the right analogue of above formula for a manifold with metric? Perhaps:


*

*integration over all closed curves of the expression $e^{-l(D)s}$

*summation over positive sums of classes of closed geodesics.


I think I've heard something about definition 2, but I suspect if the two above are defined correctly they will be the same. Is it possible to formalize this definition? Do different formalizations lead to the same zeta-function?
Updates
Yes, I think this should be related to Laplacians, Selberg trace formula and dynamical system zetas. What I said I've heard about definition 2 was probably the Selberg zeta, but I can't say it clearly, hence questions.
 A: There's been a lot of work since Smale's idea of a dynamical zeta function for general flows (in particular geodesic flows).  A good starting point would be this 12 year old review by Baladi. There is a large and more recent literature but I'm no expert, although this other review by Liverani and Tsuji is probably not far from current knowledge.
There's also a whole branch of physics around those ideas, indeed related to the spectrum of the Laplacian and applications to quantum physics and statistical physics. This nice physics book is a good start (in particular if you read the quote of Smale at page 3 of this chapter, and then remark 19.2 at the very end of that chapter you'll get a quick sense of the stuff you've aked for).
A: In a  slightly  different spirit,
but still carrying the analogy between closed curves and primes,
The Selberg trace formula relates a sum over the   lengths of
closed geodesics on a hyperbolic surface (compact or no)
to the spectrum of the Laplacian on said surface. 
Googling `Selberg trace wiki' will get you started here.
This formula has provided inspiration for Guillemin
and collaborators working in spectral geometry and micro-local
analysis. 
