Umar bin Khattab set out for Sham, and when he reached Sargh, the commanders of the army, Abu Ubayda bin Jarra and his companions, met him and informed him that an epidemic had broken out in Sham. The hadith goes on to mention the discussion that followed.Then Abdul-Rahman bin Awf came, having been absent attending to some need of his, and said, "I have some knowledge about this. I heard the Messenger of Allah ﷺ say, 'If it occurs in a land while you are in it, do not leave fleeing from it, and if you hear of it in a land, do not enter it.'"So Umar praised Allah and then departed.
حدثنا إسحاق بن عيسى أخبرني مالك عن الزهري عن عبد الحميد بن عبد الرحمن بن زيد بن الخطاب عن عبد الله بن عبد الله بن الحارث بن نوفل
أن عمر بن الخطاب خرج إلى الشام حتى إذا كان بسرغ لقيه أمراء الأجناد أبو عبيدة بن الجراح وأصحابه فأخبروه أن الوباء قد وقع بالشام فذكر الحديث قال فجاء عبد الرحمن بن عوف وكان متغيبا في بعض حاجته فقال إن عندي من هذا علما سمعت رسول الله ﷺ يقول إذا كان بأرض وأنتم بها فلا تخرجوا فرارا منه وإذا سمعتم به بأرض فلا تقدموا عليه قال فحمد الله عمر ثم انصرف
Its chain of transmission is sahih. It is a longer version of 1679. See also the previous one. The hadith occurs within a longer narrative in Muwatta 3:89-91.