pretty sure you can find every legendary in ultra space, so could you find cosmog, cosmoem, sogaleo or luna there? or do I need to have it traded to my game?
No, but Cosmog can be found in the reverse world at nighttime in real life via the ultra wormhole. this will appear as it's own option (like ultramegaopolis). After you go in, you get cosmog at the lake of the Sunne (pokemon ultra moon) or Moone (pokemon ultra sun).
Note: You need your box legendary in your party
Sadly, you cannot find Cosmog, its evolutions, Poipole, Naganadel, Stakataka, or Blacephalon via the Ultra Wormhole Ride. You can, however, get a single Cosmog per game. Here's a how-to video - hope this answer helped: https://www.youtube.com/watch?v=sDHkICGqpcg