How did the Klingon court get Kirk's personal log for the hearing?
Lieutenant Valeris, the female Vulcan who volunteered as helmsman, made the recording and gave it to the Klingons.
From the movie, an hour and 26 minutes in:
VALERIS: I did not fire. You cannot prove anything.
KIRK: Yes I can. At my trial, my personal log was used against me. How long did you wait outside my quarters before I noticed you?
The Klingons didn’t get Kirk’s personal log, but Valeris made her own recording of Kirk while he was making his log.
Valeris never admitted to making the recording, but after the conversation above, she admitted to trying to derail the peace conference. Spock may have verified that she recorded Kirk during his mind meld with Valeris a couple minutes later, but it didn’t matter much at that point.