rewrite the file in external_log