Sundogs and moondogs are the names given to rainbow-like patches sometimes seen on either side of the Sun or the Moon. They are similar to the ring sometimes seen around the Moon.
Sundogs and the ring around the Moon are caused by the focused reflection from ice crystals in the upper atmosphere. Since the ice crystals are hexagons, the distance the sundogs are from the Sun and the radius of the ring around the Moon are always the same size in the sky (22 Degrees).
More information here: