If it's a dynamo its likely to be brushes. Failing that, voltage regulators can stick, but it's one for the auto electrician if you don't know car electrica. It might just be dirty connections.
DaveW '05 Red Roadster S1 '16 Yellow (Not the only) Narrow AR GDI Plus 4