I have accidentally overwritten the syslog-ng.conf file, which is now empty.
How can I recover its previous version?
That is highly dependent on your system, but there is no way to restore the original configuration file from syslog-ng itself, because it does not have all the information, nor keeps open the file. It parses the configuration file, and creates an internal representation (which is not one to one), also nor the syslog-ng has a way to dump out this internal representation.
If you do not have any kind of backup or way to restore, the re-creation of the configuration file is the easier path.