Thanks a lot for your support and time Daniel
On Wed, Dec 11, 2013 at 7:54 AM, Daniel-Constantin Mierla
<miconda(a)gmail.com <mailto:miconda@gmail.com>> wrote:
Hello,
what operating system are you using?
Looking at the code, it closes the old fd and reopens the file by
name. So that should do it ok. Are you moving the files before or
after rotate command?
Perhaps worth adding support for renaming the file inside kamailio
rotate command.
Cheers,
Daniel
On 04/12/13 15:24, Abdelkader Allam wrote:
Hello I am doing it manually with a script
which does the
renaming (basically it is a unix mv)
from glob import glob
from time import time,sleep
kamcdrroot="/var/log/kamailio/"
from datetime import datetime
from os import system
def mv(fname1,fname2):
return system("mv %s %s" % (fname1,fname2))
#while True:
if True:
timestamp=time()
prefix=datetime.utcfromtimestamp(timestamp).strftime("T%Y%m%d%H%M")
cdrfiles=glob(kamcdrroot+"*.log")
cdrlist=[]
for cdrfile in cdrfiles:
newname=kamcdrroot+prefix+cdrfile[cdrfile.rfind("_"):cdrfile.rfind(".")]+".CDT"
cdrlist.append(newname)
mv(cdrfile,newname)
print system("kamcmd flatstore.rotate")
sleep(30)
for cdrfile in cdrlist:
mv(cdrfile,cdrfile[:-1]+"R")
so basically the result is the following (i did a few kamailio
restart):
root@corex-mc1s:/var/log/kamailio# ls -la
total 328020
drwxrwxrwx 2 root root 4096 déc. 4 13:17 .
drwxr-xr-x 14 root root 4096 déc. 4 13:15 ..
-rw-r--r-- 1 root root 23218 déc. 4 14:23 acc_134.log
-rw-r--r-- 1 root root 21196 déc. 4 14:23 acc_135.log
-rw-r--r-- 1 root root 24509 déc. 4 14:23 acc_136.log
-rw-r--r-- 1 root kamailio 14093392 déc. 4 12:29
T201312041208_129.CDR
-rw-r--r-- 1 root kamailio 14201702 déc. 4 12:29
T201312041208_130.CDR
-rw-r--r-- 1 root kamailio 13882004 déc. 4 12:29
T201312041208_131.CDR
-rw-r--r-- 1 root kamailio 13955029 déc. 4 12:29
T201312041208_132.CDR
-rw-r--r-- 1 root kamailio 4656028 déc. 4 12:29
T201312041208_133.CDR
-rw-r--r-- 1 root kamailio 4587433 déc. 4 12:29
T201312041208_134.CDR
-rw-r--r-- 1 root kamailio 4553151 déc. 4 12:29
T201312041208_135.CDR
-rw-r--r-- 1 root kamailio 4528270 déc. 4 12:29
T201312041208_136.CDR
-rw-r--r-- 1 root kamailio 64318780 déc. 4 12:05
T201312041208_137.CDR
-rw-r--r-- 1 root kamailio 64275486 déc. 4 12:05
T201312041208_138.CDR
-rw-r--r-- 1 root kamailio 64404707 déc. 4 12:05
T201312041208_139.CDR
-rw-r--r-- 1 root kamailio 64222391 déc. 4 12:05
T201312041208_140.CDR
-rw-r--r-- 1 root kamailio 130646 déc. 4 11:53 T201312041208_1.CDR
-rw-r--r-- 1 root kamailio 755148 déc. 4 13:14
T201312041232_129.CDR
-rw-r--r-- 1 root kamailio 778238 déc. 4 13:14
T201312041232_130.CDR
-rw-r--r-- 1 root kamailio 749920 déc. 4 13:14
T201312041232_131.CDR
-rw-r--r-- 1 root kamailio 761826 déc. 4 13:14
T201312041232_132.CDR
-rw-r--r-- 1 root kamailio 11378 déc. 4 13:13
T201312041232_133.CDR
-rw-r--r-- 1 root kamailio 11847 déc. 4 13:09
T201312041232_134.CDR
-rw-r--r-- 1 root kamailio 8599 déc. 4 13:13
T201312041232_135.CDR
-rw-r--r-- 1 root kamailio 11485 déc. 4 13:13
T201312041232_136.CDR
-rw-r--r-- 1 root root 97523 déc. 4 14:24
T201312041316_129.CDR
-rw-r--r-- 1 root root 93268 déc. 4 14:23
T201312041316_130.CDR
-rw-r--r-- 1 root root 91166 déc. 4 14:23
T201312041316_131.CDR
-rw-r--r-- 1 root root 94052 déc. 4 14:23
T201312041316_132.CDR
-rw-r--r-- 1 root root 27300 déc. 4 14:23
T201312041316_133.CDR
-rw-r--r-- 1 root root 770 déc. 4 13:15
T201312041316_134.CDR
-rw-r--r-- 1 root root 378 déc. 4 13:15
T201312041316_135.CDR
-rw-r--r-- 1 root root 765 déc. 4 13:15
T201312041316_136.CDR
-rw-r--r-- 1 root root 8361 déc. 4 14:23 T201312041316_1.CDR
On Wed, Dec 4, 2013 at 2:07 PM, Daniel-Constantin Mierla
<miconda(a)gmail.com <mailto:miconda@gmail.com>> wrote:
Hello,
how you do the files rotation? The readme is saying that has
to be done via an external application. Nothing has change in
this regard for many years.
Cheers,
Daniel
On 12/4/13 2:31 PM, Abdelkader Allam wrote:
Hello Guys,
I am using Kamailio 4.1.0. I am trying to get Kamailio to
rotate the cdr log through command kamcmd flatstore.rotate
but it keeps sending log to the renamed files,
I use the following parameter (i tried to set flush to 1 and
0, same result, i have also tried in debug and normal mode)
#!define WITH_ACCFILE
# ----- acc params -----
/* what special events should be accounted ? */
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
/* by default ww do not adjust the direct of the sequential
requests.
if you enable this parameter, be sure the enable
"append_fromtag"
in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc", "log_extra",
"src_user=$fU;src_domain=$fd;src_ip=$si;"
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
/* enhanced DB accounting */
modparam("acc", "db_flag", FLT_ACC)
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
#!ifdef WITH_ACCFILE
modparam("acc", "db_url",
"flatstore:/var/log/kamailio")
modparam("db_flatstore", "flush", 1)
modparam("acc", "cdr_enable", 1)
#modparam("acc", "cdr_flag", 3)
modparam("acc", "db_extra","ds=$DLG_lifetime")
modparam("acc", "log_extra",
"src_user=$fU;src_domain=$fd;src_ip=$si;"
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;"
"duration=$DLG_lifetime")
modparam("acc", "db_extra",
"src_user=$fU;src_domain=$fd;src_ip=$si;"
"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;"
"duration=$avp(i:256)")
#!endif
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users(a)lists.sip-router.org <mailto:sr-users@lists.sip-router.org>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -http://www.asipto.com
http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda>
-http://www.linkedin.com/in/miconda
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
mailing list
sr-users(a)lists.sip-router.org
<mailto:sr-users@lists.sip-router.org>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users