dhcp log script ???

i want a mikrotik router script that can be do dhcp log like my log file settings.
i add a file standart mikrotik dhcp log file . but i want that like my_log.txt and every hour send them to ftp server . thats all … i wait yours offer.


script make the assigned ip-mac hold on in memory when the ip-mac deassigned write the log file then send them every 1 hour to ftp . log file name like dhcplog-(identity)-dd-mm-yyyy_HH-mm.txt


for example :
Jan/02/1970 02:12:52 dhcp,info dhcp1 assigned 10.5.50.254 to AC:22:0B:B8:13:ED ( hold in memory or file )
Jan/02/1970 02:29:37 dhcp,info dhcp1 deassigned 10.5.50.254 from AC:22:0B:B8:13:ED ( when its deassigned write the real log file.then forget this lines)

dhcplog-(identy)-dd-mm-yyyy_HH-mm.txt ( its fill the date and time when ftp to server )

IP adress assigned date-time deassigned date-time MAC Adress
10.5.50.254 02.01.1970-02:12:52 02.01.1970-02:29:37 AC:22:0B:B8:13:ED
mikrotik dhcp log.txt (324 Bytes)
my_log.txt (451 Bytes)

Görkem bey merhaba,
Siz mikrotikde 5651 nasıl çözdünüz. Script arıyorum ama bulamadım. Siz nasıl çözdünüz.
Teşekkürler.

Try this here,
insert in new-terminal,
don’t forgot to create first your folder in Mkt files, drag and drop the folder to files!

/system scheduler
add comment=“DHCP Lease Backup” interval=1h name=“DHCP Lease Backup”
on-event=“# Random File Saver #\r
\n# First create your Folder, drag and drop to Mkt Files #\r
\n{\r
\n# set your folder and filename here #\r
\n:local file "foldername/filename"\r
\n# do not change any more below !!! #\r
\n:local date [/system clock get date ];\r
\n:local time [/system clock get time ];\r
\n:local p1 [:pick $date 0 3];\r
\n:local p2 [:pick $date 4 6];\r
\n:local p3 [:pick $date 7 11];\r
\n:local p4 [:pick $time 0 2];\r
\n:local p5 [:pick $time 3 5];\r
\n:local p6 [:pick $time 6 8];\r
\n/ip dhcp-server lease print file=("$file" . "" . "$p1" . "$p2
" . "$p3" . "
" . "$p4" . "$p5" . "$p6");\r
\n:log warning ("DHCP Server Lease BACKUP " . "$file" . "" . "$
p1" . "$p2" . "$p3" . "
" . "$p4" . "$p5" . "$p6");\r
\n}” policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive
start-time=startup

then go to system scheduler and edit to your folder and filename

i try this script but … files are empty . What i do wrong ?