I can query debug logs via
ApexLog object with SOQL, but the result doesn't contain an actual message.
How can I access the message? Is it achievable with SOQL or some API?
Tooling API has support since v 28 to download the Raw Apex Log. See this for more info.
It is possible also with REST Api, using the following path:
"/services/data/v29.0/sobjects/ApexLog/" + logId + "/Body/"
The log Id must be known (could be fetched with simple SOQL) and only one log per request can be fetched.