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.