The traditional and still best cosmoline cleaner is kerosene. It quickly cuts the gunk and leaves a slight oily residue that impedes rust formation.
You can use any petroleum product. Mineral spirits is very close to kerosene and will work well but does not leave the residue. WD40 will work (it's primary component is a petroleum product close to mineral spirits), but it's certainly the high priced solution.
It the item has a ground, flat, cast iron surface, be sure to immediately coat it with Boeshield T9. It's the best product for rust prevention.