Just went through this last year.
Since it is intermittent it may be hard to find unless it quits all out.
1 check the connection at the rectifier make sure no burns or dirty connectors.
2 check the white connector going to the stator under the battery tray this is a weak point lots of people have just soldered the wires.
3 check your ground wires going to the battery both of them
4 if all of these are good check the stator voltage
5 if stator voltage is good check the voltage at the battery
Mine turned out to be the stator, however it is usually one of the connections.