Is there a way to access to the logs (user activity like session time and so on) of moodle through an API? and where is the documentation or the plugin for that?
It depends what you are trying to do - more detail would help.
There's no webservice call to access the logs. However, it's just a database table. If you're extending Moodle then it's easy enough to write a plugin that reads that table.
Oh... "like session time" is one thing you're going to have fun getting from the logs. The logs contain "events" - when users did something.
I am trying to access logs in such database, but I don't want, neither know how to implement that plugin, maybe there is an existing plugins that expose a API web service for retrieve logs from database in json format or something similar?