Page 1 of 1

Can't Remove Userman Logs

Posted: Sun Jan 20, 2008 11:14 pm
by winagain
Hi All,

I am having a problem with removing userman logs, but when I issue the command

/tools/user-manager/logs/print

/tools/user-manager/logs/remove 1-xxx

I get error time out detected!

I have a total of 219000 entries, and even when I try only do 1-20 it fails.

I have managed to install a script on the other routers, and this works, but when I add to this one in particular it also fails.

We are opperating RB532 with ROS2.9.46 on the board that is having problems!

Any help in getting this sorted out will be greatly appreciated.

Re: Can't Remove Userman Logs

Posted: Sat Feb 16, 2008 11:03 am
by Jrslick22
Im at 198,000 this is starting to become a bit of a problem. anyone?

Re: Can't Remove Userman Logs

Posted: Sat Feb 16, 2008 12:36 pm
by winagain
What I ended up doing is to backup mikrotik, clear to factory settings and re-install all my settings.

Then added a script which deletes logs.

CLEAR USERMAN LOG SCRIPT:

:local Flag
:set Flag [/tool user-manager log find]
:if ([:len $Flag] > 0) do={/tool user-manager log print append file log;/tool user-manager log remove [/tool user-manager log find];}

This will however not be a problem for us anymore as we are moving onto radius manager soon. Hopefully this does not occur on radius manager. It also has an easy setup for account management. the mikrotik emplementation is not that great. But works when the scripts are setup correctly.

Hope this helps.

Re: Can't Remove Userman Logs

Posted: Tue Feb 19, 2008 11:58 am
by Jrslick22
What I ended up doing is to backup mikrotik, clear to factory settings and re-install all my settings.

Then added a script which deletes logs.

CLEAR USERMAN LOG SCRIPT:

:local Flag
:set Flag [/tool user-manager log find]
:if ([:len $Flag] > 0) do={/tool user-manager log print append file log;/tool user-manager log remove [/tool user-manager log find];}

This will however not be a problem for us anymore as we are moving onto radius manager soon. Hopefully this does not occur on radius manager. It also has an easy setup for account management. the mikrotik emplementation is not that great. But works when the scripts are setup correctly.

Hope this helps.
SO i can literally copy and paste the script right? no editing required?

thanks mate, its a shame its come to this.

Re: Can't Remove Userman Logs

Posted: Tue Feb 19, 2008 2:33 pm
by winagain
Yes you can copy paste the script into script window:

Start --> Do Not Copy This

:local Flag
:set Flag [/tool user-manager log find]
:if ([:len $Flag] > 0) do={/tool user-manager log print append file log;/tool user-manager log remove [/tool user-manager log find];}


End --> Do Not Copy this

Another script that is usefull is this one

Clear-Userman-Sessions

Start-->Do Not Copy This

:local Flag
:set Flag [/tool user-manager session find]
:if([:len $Flag]>0) do={/tool user-manager session print; /tool user-manager session remove [/tool user-manager session find];}

End -->Do Not copy this

I set both to run on every 5 days!

Re: Can't Remove Userman Logs

Posted: Fri Jun 20, 2008 11:03 pm
by heiko_s
Hi,
i have the same problem - running unsermanager on a RB600 with damn small harddiskspace.
I'v ~ 800.000 entries in the logs.
I ran the above script but except of the fact that the CPU goes up to 100% nothing seems to happen.

Is there a way to get rid of the database and logs all x days to prevent the harddisk from running full ?

Greetz
Heiko

Re: Can't Remove Userman Logs

Posted: Thu Jul 10, 2008 10:59 am
by heiko_s
Anything new concerning this issue ?

Regards
Heiko

Re: Can't Remove Userman Logs

Posted: Thu Jul 10, 2008 4:19 pm
by jordantrx
Yes you can copy paste the script into script window:

Start --> Do Not Copy This

:local Flag
:set Flag [/tool user-manager log find]
:if ([:len $Flag] > 0) do={/tool user-manager log print append file log;/tool user-manager log remove [/tool user-manager log find];}


End --> Do Not Copy this

Another script that is usefull is this one

Clear-Userman-Sessions

Start-->Do Not Copy This

:local Flag
:set Flag [/tool user-manager session find]
:if([:len $Flag]>0) do={/tool user-manager session print; /tool user-manager session remove [/tool user-manager session find];}

End -->Do Not copy this

I set both to run on every 5 days!
do you have a scheduler on this running every day or what? -Jordan

Re: Can't Remove Userman Logs

Posted: Thu Aug 14, 2008 9:09 pm
by kourkoulis
I Have the same problem, my hard disc is full and i cannot remove the logs either from user-manager either with the scripts
i run routeros 3.11 in x86 anyone can help this issue?
nothing seems to fix this issue... and i do not know if a upgrade to 3.13 will fix this problem.

Re: Can't Remove Userman Logs

Posted: Fri Aug 15, 2008 2:26 pm
by heiko_s
concerning the changelog, nothing new was added to the usermanager.
i guess, there is no possibility to clear the logs.

Re: Can't Remove Userman Logs

Posted: Mon Aug 18, 2008 9:32 am
by sergejs
Logs management will be improved in the new improved User Manager, which will be released soon.

Re: Can't Remove Userman Logs

Posted: Mon Aug 18, 2008 11:32 am
by airstream
I Have the same problem, my hard disc is full and i cannot remove the logs either from user-manager either with the scripts
i run routeros 3.11 in x86 anyone can help this issue?
nothing seems to fix this issue... and i do not know if a upgrade to 3.13 will fix this problem.
To delete the UM logs try:
:local Flag
:set Flag [/tool user-manager log find]
:if ([:len $Flag] > 0) do={/tool user-manager log remove [/tool user-manager log find];}
To export to file then delete UM logs try:
:local Flag
:set Flag [/tool user-manager log find]
:if ([:len $Flag] > 0) do={/tool user-manager log print append file log;/tool user-manager log remove [/tool user-manager log find];}

Re: Can't Remove Userman Logs

Posted: Thu Dec 03, 2009 9:51 am
by digital-steve
Hello,

i have installed the script, but the logs canĀ“t remove.
The usermanager-log has 2 million (!!!) entries in the log and the database is getting bigger every day.
After 15h with 100% cpu-load (P4 2.4GHz, 512MB), I canceled the script.
The radius-server must be disabled before I start the script?
(ROS V3.30)

Regards

Re: Can't Remove Userman Logs

Posted: Sat Dec 05, 2009 4:47 pm
by eneimi
When I executed the scripts in winbox, they didn't run. But they did the job when executed via CLI. You may want to try that if you haven't already.

Re: Can't Remove Userman Logs

Posted: Tue Dec 08, 2009 9:44 am
by digital-steve
I have startet the script in CLI. How long does the deletion of log files? I stopped after 2 h with 100% CPU load.

Re: Can't Remove Userman Logs

Posted: Tue Dec 08, 2009 7:22 pm
by new_one
Logs management will be improved in the new improved User Manager, which will be released soon.

when it will be soon??

it have past now like nearly 2 years and nothing is changed... :-x :-x :-x :-x :-x :-x :-x

my session are still growing and growing and I CAN'T DELETE THEM !!!!! i have try'd manuali to delete im http://local_ip/userman but it dosent work..!!!!

p.s.
i have a rb 411 and im runnig v4.3

can someone help me

tnx
bye

Re: Can't Remove Userman Logs

Posted: Wed Dec 09, 2009 10:47 am
by sergejs
1) What do you have in tool user-manager router print configuration.
Make sure you are not logging information, which is not necessary for you.

[admin@MikroTik] /tool user-manager router> print

Flags: X - disabled
0 customer=administrator name="test"
ip-address=127.0.0.1
shared-secret="test" log=auth-fail
coa-port=1700

it is enough to log only auth-fail.

2) Note, that when you launch the command to remove the logs, you might see that timeout from console, but it does not mean that logs are not being remove. You need to wait 10-15 minutes (perhaps logs will be removed after this time).

Re: Can't Remove Userman Logs

Posted: Wed Dec 09, 2009 8:43 pm
by new_one
the problem is that i dont log anythig..
and the log's are not so much problem like the sessions...

i have 0 log's (userman) but i have like 2000 session in 1 day...and my hdd space is limited to 32mB (rb 411 that have 64mB total) and every few day it smaller and smaller and i don't now how to delete all sessions at one's and i can't see any option to autmatic delete the session..


my suggestion is for next user manager pls put some time scheduler in it..so that when it reach like 5000 sessions that the last one's delete automatic..

or can you tell me some script that will automatic delete like every 10 day's all seasons??
i use v4.3


tnx for replay
bye

Re: Can't Remove Userman Logs

Posted: Fri Feb 12, 2010 6:33 am
by ipans
try this script to delete all UM logs :
:foreach i in=[/tool user-manager log find] do { /tool user-ma
nager log remove $i; }

Re: Can't Remove Userman Logs

Posted: Fri Apr 23, 2010 6:44 am
by petrucci2
try this script to delete all UM logs :
:foreach i in=[/tool user-manager log find] do { /tool user-manager log remove $i; }

thanks a lot.... the script works very fine !!!

If you want delete the session, only change two words:
try this script to delete all UM sessions :
:foreach i in=[/tool user-manager session find] do { /tool user-manager session remove $i; }

Re: Can't Remove Userman Logs

Posted: Fri Apr 23, 2010 10:15 am
by adilazzubaidi
use this script
/tool user-manager database clear-log

Re: Can't Remove Userman Logs

Posted: Sat Apr 24, 2010 8:31 am
by Gareth
use this script
/tool user-manager database clear-log
I get the following error when i try that:
bad command name clear-log (line 1 column 29)

Re: Can't Remove Userman Logs

Posted: Wed Apr 28, 2010 5:13 pm
by Gareth
I've tried all the methods mentioned above. None of them work. The CPU sits at 100% for hours, no one can log in (RADIUS server not responding) and when I finally abort the script, I find that absolutely nothing, not even 1 log entry has been deleted.

The only way I've managed to delete them is via user manager's web interface. I've removed 27,000 so far, but I can only do it 100 at a time because there is so little drive space left that it causes errors when I try to delete 500 or 1000. This method is EXTREMELY time consuming and it also causes users not to be able to log in. Not only that, but I still haven't managed to free up any space. Does anyone know why? Surely there must be an easier way??

Why can't the log be kept in a separate file, visible in Winbox's file list, that can then be easily deleted.

Re: Can't Remove Userman Logs

Posted: Tue May 11, 2010 1:31 pm
by sergejs
Thank you for the suggestion about saving logs to file.
/tool user-manager log remove [find] should remove the logs, even when it reports timeouts to the console.

You can modify /tool user-manager router and disable unused logging topics, which will saves log space very efficiently,
I'm talking about log=auth-fail in /tool user-manager router

Re: Can't Remove Userman Logs

Posted: Wed May 12, 2010 6:07 am
by polokus
is it possible to move the userman database to a separate harddrive? anyone can point me to the right direction?

Re: Can't Remove Userman Logs

Posted: Wed May 12, 2010 8:36 am
by sergejs
Yes, it is possible.

Make database backup to be sure (of having backup for emergency),
then copy User Manager store file to the secondary disk,
/store copy user-manager to=secondary_disk_name.

Re: Can't Remove Userman Logs

Posted: Wed May 12, 2010 2:52 pm
by polokus
Already done that but the harddrive already full only left 1mb so cannot store the usermanager database (*.umb), when i try to copy to new harddrive (using store copy) it says error timeout and a suggestion to contact mikrotik support with attached supout.rif (which i did).
any other ways to workaround this? btw the user-manager log already set to minimum which is only logs failed attempt.

Re: Can't Remove Userman Logs

Posted: Thu Jun 03, 2010 5:40 am
by trevorlc1234
I found these two scripts to work nicely.
I first tried the ones listed above, the one to remove userman logs and place a export of the file in the root directory called log.txt worked. but the cut and pastes for removing user sessions did not. I dug through the script that I cut and pasted from this forum and found some errors with missing spaces etc. So this is what I have and what is working for me.

Create 2 script's in Winbox

1. Called "Clear_Userman_Logs_Send_to_Log_txt"
And use this code
:local Flag
:set Flag [/tool user-manager log find]
:if ([:len $Flag] > 0) do={/tool user-manager log print append file log;/tool user-manager log remove [/tool user-manager log find];}
2. Called "Clear_Userman_Sessions_Send_to_Session_txt"
:local Flag
:set Flag [/tool user-manager session find]
:if ([:len $Flag] > 0) do={/tool user-manager session print append file session;/tool user-manager session remove [/tool user-manager session find];}
Then schedule each script to however much you want.
Remember that you should download and then delete the two files that it creates on your routers file system called log.txt and session.txt and retain those on your PC or wherever if you want a record.
If you don't want the scripts to first output a copy of what it deletes to log.txt and session.txt on your routers file system then in the code, for both scripts remove the wording " append file session" so that you have something that looks like this

Create 2 script's in Winbox

1. Called "Clear_Userman_Logs"
And use this code
:local Flag
:set Flag [/tool user-manager log find]
:if ([:len $Flag] > 0) do={/tool user-manager log print;/tool user-manager log remove [/tool user-manager log find];}
2. Called "Clear_Userman_Sessions"
:local Flag
:set Flag [/tool user-manager session find]
:if ([:len $Flag] > 0) do={/tool user-manager session print;/tool user-manager session remove [/tool user-manager session find];}
With a litte bit more scripting, you could make it, instead of store the file on your routers file system, email the file to you, then delete the stored file, so it does not take up space and you don't have to worry about downloading it. Eventually I will figure that out.

Re: Can't Remove Userman Logs

Posted: Thu Sep 23, 2010 6:42 pm
by Red0ktober
I've tried these scripts on v4.11, but they don't seem to do anything. Don't seem to hit the processor either.

My backup weighs in at 24.7Mb. Our UM server is x86, but just as an exercise I tried to restore the database to an RB450G (also running v4.11), but it times out. I think I need to thin down the file first. I have 284000 under sessions and 156000 under logs.

Re: Can't Remove Userman Logs

Posted: Sun May 08, 2011 11:38 pm
by Staaldraad
try this script to delete all UM logs :
:foreach i in=[/tool user-manager log find] do { /tool user-ma
nager log remove $i; }

Thank you very much, this worked well for me. ( RB411AH v4.16 )

What I did was run the script from winbox, cpu goes up to 100%, and leave it alone. I had 127000 log entries and it took about 30 min to complete.

Then run script /tool user-manager database rebuild and you will have a clean log and lots of disk space.

Hope this helps anyone