New to me bike, 1st time oil change...warmed up the engine to help aid in the draining process. Took off the top oil cap and there was this slimy, foamy sludge on the top cap. I also noticed this substance settled in the oil level indicator window. Needless to say, I changed the oil and oil filter but what the heck is this stuff?
OOooohh, usually means coolant mixed in. On better note, could be a bunch of internal condensation from the machine not running but sitting in dampish location. I'd change the oil after a ride and watch the coolant level, doesn't take much to make the foam. This also happens when owners think they are helping during winter storage to "Start the engine for a couple of minutes" every week or so. Eeek. Never. YMMV.
When coolant mixes with oil you tend to get a grayish sludge. The yellow slime is very common, typically from condensation built up in the crank case. As SinNH suggests can be caused by running the engine for short periods of time. Not allowing the engine to get warm enough to burn off the condensation. Not unusual to see when bike is stored in cold damp place for winter. Check in the oil inspection window. If you have some kind of coolant leak you'll see that gray slime there as well. Plus you'd have other symptoms from a coolant leak like disappearing coolant & blowing white smoke. Clean the cap, run it & keep an eye on it.
this seems to be more specific to Ducati, I have seen quite a few with clouded out windows, thing is this; as soon as you run the bike and bring it up to temperature, the clouding goes away. I also think, I have seen this on a few air-head beemers...My bike has a proper dip-stick where you can actually get up-close and personal with that oil. Smell it, touch it, you get the idea, and I dont wana see some half-wit twist that into some sordid garage porn escapade... You didnt say what state you live in. Its nothing to worry about....