Something like this should work, but if you have a large number of log files, it may be an ineffective way to iterate, also you have to check for the maximal value of Cardinal.
Delphi-Quellcode:
procedure CreateLog;
var i: Cardinal;
begin
i:= 1;
while FileExists(IntToStr(i)+'.log') do //use format for left-hand zeros
begin
inc(i);
end;
//CreateFile ...
end;