Community discussions

MikroTik App
 
turtleandant
just joined
Topic Author
Posts: 4
Joined: Wed Apr 18, 2012 6:22 am

PPP user real ip logging

Wed Apr 18, 2012 7:24 am

Hello, Mikrotik Users.

I want to log the VPN USER's(PPTP, L2TP) real ip address.

This is my logging script. But I have some problem.


/system script add name=pppactivelist source= {
:local userid;
: local i;
: local realip;
: local vpnip;
: local uptime;
: local crttime;
: local crtdate;
: local logmsg;

:foreach i in=[/ppp active find] do={
:set userid [/ppp active get $i];
:set realip [/ppp active get $i caller-id];
:set vpnip [/ppp active get $i address];
:set uptime [/system active get $i uptime];
:set crtdate [/system clock get date];
:set crttime [/system clock get time];

:set longmsg "TIME: $crtdate $crttime, USER_ID: $userid, REAL-IP: $realip, VPN-IP: $vpnip, UP-TIME: $uptime";

:log info (" $logmsg ");
}

}


/system scheduler
add disabled=no interval=1m name=pppactivelist on-event=pppactivelist start-time=startup



The Problem is that duplicated lines in log info exist.

I want to make a script schedule 3 minutes to record only new pptp user's connection informations in remote log server.

Could you help me how to make a script?

I means that every new pptp user's connection information should be logged in my remote log server.

Thank you for your reading.
 
rodolfo
Long time Member
Long time Member
Posts: 553
Joined: Sat Jul 05, 2008 11:50 am

Re: PPP user real ip logging

Wed Apr 18, 2012 9:05 am

/system logging
add action=memory disabled=no topics=pppoe,account
 
turtleandant
just joined
Topic Author
Posts: 4
Joined: Wed Apr 18, 2012 6:22 am

Re: PPP user real ip logging

Wed Apr 18, 2012 10:17 am

thank you for your reply. but, Our customers use PPTP, LPTP VPN service, not PPPoE service.
 
rodolfo
Long time Member
Long time Member
Posts: 553
Joined: Sat Jul 05, 2008 11:50 am

Re: PPP user real ip logging

Wed Apr 18, 2012 3:01 pm

try 'ppp' or 'pptp' topic instead
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: PPP user real ip logging

Wed Apr 18, 2012 9:54 pm

try this script


{
:local userid;
: local i;
: local realip;
: local vpnip;
: local uptime;
: local crttime;
: local crtdate;
: local logmsg;
:local userid
:global tmp1

:foreach i in=[/ppp active find] do={
:set userid [/ppp active get $i name];
:set realip [/ppp active get $i caller-id];
:set vpnip [/ppp active get $i address];
:set uptime [/ppp active get $i uptime];
:set crtdate [/system clock get date];
:set crttime [/system clock get time];

:set logmsg "TIME: $crtdate $crttime, USER_ID: $userid; REAL-IP: $realip, VPN-IP: $vpnip, UP-TIME: $uptime";
if ($tmp1!=$realip) do={:log info (" $logmsg ")};
:set tmp1 [/ppp active get $i caller-id];
}
}

Who is online

Users browsing this forum: No registered users and 27 guests