An automatic milking system comprising - a control system comprising an electronic control unit, - at least one milking station configured to milk animals, - a production milk tank for receiving milk from the milking station, - a second milk tank configured to receive milk diverted from the milking station and not conducted to the production milk tank, - an animal identification system connected to the control unit, configured to provide the control unit with individual identification information of animals milked the automatic milking system, - at least one first sensor configured to measure at least one indicator of illness of an animal, said sensor being connected to the control unit, - a data memory in which measurements performed by the first sensor on milk from individual animals identified by the animal identification system are gathered, wherein the time of each measurement is also registered and saved in the data memory, the automatic milking system being characterized in that the control unit is configured to - register a first point of time at which milk from an animal is diverted to the second milk tank instead of being conducted to the production milk tank, and, - provided that the milk of the animal has been diverted from the milking station to the second milk tank for a plurality of consecutive milking sessions after the first point of time, register a second point of time at which milk from the animal is shifted from being conducted to the second milk tank to being conducted to the production milk tank, and - if the time period between the first point of time and the second point of time is within a predetermined number days, the control unit is configured to determine that the animal was in an illness state between the first point of time and the second point of time. - a control system comprising an electronic control unit, - at least one milking station configured to milk animals, - a production milk tank for receiving milk from the milking station, - a second milk tank configured to receive milk diverted from the milking station and not conducted to the production milk tank, - an animal identification system connected to the control unit, configured to provide the control unit with individual identification information of animals milked the automatic milking system, - at least one first sensor configured to measure at least one indicator of illness of an animal, said sensor being connected to the control unit, - a data memory in which measurements performed by the first sensor on milk from individual animals identified by the animal identification system are gathered, wherein the time of each measurement is also registered and saved in the data memory, the automatic milking system being characterized in that the control unit is configured to - register a first point of time at which milk from an animal is diverted to the second milk tank instead of being conducted to the production milk tank, and, - provided that the milk of the animal has been diverted from the milking station to the second milk tank for a plurality of consecutive milking sessions after the first point of time, register a second point of time at which milk from the animal is shifted from being conducted to the second milk tank to being conducted to the production milk tank, and - if the time period between the first point of time and the second point of time is within a predetermined number days, the control unit is configured to determine that the animal was in an illness state between the first point of time and the second point of time.