Just to specifically answer your questions.
> How long afterwards are they able to see it?
It depends on how long they store it. They get your IP each time you send any request to the relay. It is not only posting, but searching, browsing global, every interaction with the relay makes your IP visible.
> Is the IP posted together with the event and recorded on relay forever?
Not posted with event. Seen with every interaction. Retention depends on the relay settings, that you don't know and can't control.
> Or do they specifically have to log the IP at the time of posting?
They have to specifically log the IP, but most probably the webserver sw e.g. nginx logs it by default. Webservers usually log all requests by default.