A rock drilling machine comprising: a body; a shank, which is bearing mounted to the body by means of at least one first bearing, and which shank comprises a first end and a second end, the first end being provided with connecting members for connecting a drilling tool; a first gear on an outer surface of the shank; at least one rotating sleeve around the shank; a second gear on an inner surface of the rotating sleeve, the second gear being in a tooth contact with the first gear; a third gear on an outer surface of the rotating sleeve; a rotating device comprising at least one rotating motor for generating rotation and transmission elements for transmitting the rotation to the third gear; at least one second bearing for bearing mounting the rotating sleeve rotationally inside a bearing space in the body; and a lubricating system comprising at least one feed duct for feeding a pressurized lubricating fluid to the tooth contact between the first gear and the second gear; wherein the tooth contact between the first gear and the second gear comprises operational flank surfaces between opposing teeth; at least one flank surface in each tooth contact is provided with at least one groove; and the feed duct of the lubricating system is in connection with the grooves, allowing the lubricating fluid to be fed to the tooth contact and to flow in the at least one groove of the flank surface wherein the groove in the flank surface is elongated and has ends; characterized in that at least one end of the groove is open; and the lubricating fluid fed to the groove is arranged to flow in the groove towards the at least one open end. a body; a shank, which is bearing mounted to the body by means of at least one first bearing, and which shank comprises a first end and a second end, the first end being provided with connecting members for connecting a drilling tool; a first gear on an outer surface of the shank; at least one rotating sleeve around the shank; a second gear on an inner surface of the rotating sleeve, the second gear being in a tooth contact with the first gear; a third gear on an outer surface of the rotating sleeve; a rotating device comprising at least one rotating motor for generating rotation and transmission elements for transmitting the rotation to the third gear; at least one second bearing for bearing mounting the rotating sleeve rotationally inside a bearing space in the body; and a lubricating system comprising at least one feed duct for feeding a pressurized lubricating fluid to the tooth contact between the first gear and the second gear; wherein the tooth contact between the first gear and the second gear comprises operational flank surfaces between opposing teeth; at least one flank surface in each tooth contact is provided with at least one groove; and the feed duct of the lubricating system is in connection with the grooves, allowing the lubricating fluid to be fed to the tooth contact and to flow in the at least one groove of the flank surface wherein the groove in the flank surface is elongated and has ends; characterized in that at least one end of the groove is open; and the lubricating fluid fed to the groove is arranged to flow in the groove towards the at least one open end.