I wrote a script which fetches the log records via POST request
https://" + env.getHost() + "/Thingworx/Logs/" + logType + "/Services/QueryLogEntries
e.g.
ApplicationLog,ScriptLog,
body
{\n" + " \"startDate\": \"" + startDate + "\",\n" + " \"endDate\": \"" + endDate + "\",\n" + " \"maxItems\": 1000000,\n" + " \"fromLogLevel\": \"ALL\",\n" + " \"instance\": \"\",\n" + " \"origin\": \"\",\n" + " \"searchExpression\": \".*.*\",\n" + " \"thread\": \"\",\n" + " \"toLogLevel\": \"ALL\",\n" + " \"user\": \"\",\n" + " \"isRegex\": true,\n" + " \"oldestFirst\": false\n" + "}and saves them into a file. like what Composer Monitoring uses to fetch logs. It’s not ideal - but works :D
If you have access to the ThingworxStorage directly you could get the logs via file system. But I only have Composer access and need to download them like that..