I get "504 Gateway Time-out" (no other information, also looked in the page source of that error page) on trying to get the upload log of Sep 30, 2013 at the Commons:
Unsurprisingly, the API has the same problem:
Even the API returns a bland "504 Gateway Time-out" HTML page.
Re-trying the timed-out query (either Special:Log or the API call) again may then succeed, sometimes only after several re-tries. However, the answer still takes very long to compute.
May be difficult to reproduce. It happened to me yesterday, until it suddenly started to work. So I thought it was a spurious effect and did not yet file a bug report. However, today exactly the same thing happened, so here's the bug report.
Looks like something gets cached and takes very long getting cached, so the first few attempts time out. But once the thing (whatever it is, a database index?) is cached, subsequent queries work, also for other dates in the vicinity of the initial date. That would at least explain the behavior I'm seeing. I presume the cached data gets evicted from the cache after some time, so re-trying the query the next day has to re-cache it and then initially times out again.
Even when it finally works, it's often rather sluggish to return results.