As others have said, relays see your IP when you connect, it can be linked to your npub when you post/react/etc. I believe some clients connect to the relay on your behalf.
You need to use a VPN if you're worried about your real IP address being known - this is true for any service, Nostr included.
I don't think most relays keep logs (at least I don't, as Strfry doesn't log by default). Also an IP address by itself isn't really worth anything to anyone other than your government. If they're trying to track you down at all costs then you've got bigger problems, but they have easier ways to figure it out anyway.