<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
<div class="moz-cite-prefix">On 11/12/13 10:03, Abdelkader Allam
wrote:<br>
</div>
<blockquote
cite="mid:CAKd4xH9uJy41Fpo4oJS0zTzgJnT+X5vBRxiS0tXyvZFB=EihTw@mail.gmail.com"
type="cite">
<div dir="ltr">Hello Daniel,
<div><br>
</div>
<div>I am using Debian Squeeze and I am moving the file before
the rotate.</div>
<div><br>
</div>
<div>Unfortunately i had not time to debug kamailio's code to
find the issue, i read quickly some part of the db_flatstore
module but i need to figure out how to debug and understand
how kamcmd passes commands to each kamailio process instance..
Sometimes when calling the rotate command some process do
close the fd and reopen it, but not all processes and it
doesn't work all the time.</div>
</div>
</blockquote>
<br>
the files are closed/reopened when there is a new record to write,
it is not done immediately on rotate mi/rpc command. The rotate
command itself just sets the current timestamp as timeline after
which the rotate has to be done. When a new record is to be written,
each process tests if timestamp at that moment is less than rotate
timeline and if yes, then closes and reopens the log file.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote
cite="mid:CAKd4xH9uJy41Fpo4oJS0zTzgJnT+X5vBRxiS0tXyvZFB=EihTw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Thanks a lot for your support and time Daniel</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Dec 11, 2013 at 7:54 AM,
Daniel-Constantin Mierla <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:miconda@gmail.com"
target="_blank">miconda@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hello,<br>
<br>
what operating system are you using?<br>
<br>
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?<br>
<br>
Perhaps worth adding support for renaming the file inside
kamailio rotate command. <br>
<br>
Cheers,<br>
Daniel
<div>
<div class="h5"><br>
<br>
<div>On 04/12/13 15:24, Abdelkader Allam wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hello I am doing it manually with a
script which does the renaming (basically it is a
unix mv)
<div><br>
</div>
<div>
<div>from glob import glob</div>
<div>from time import time,sleep</div>
<div>kamcdrroot="/var/log/kamailio/"</div>
<div>from datetime import datetime</div>
<div>from os import system</div>
<div><br>
</div>
<div>def mv(fname1,fname2):</div>
<div> return system("mv %s %s" %
(fname1,fname2))</div>
<div><br>
</div>
<div><br>
</div>
<div> #while True:</div>
<div>if True:</div>
<div> timestamp=time()</div>
<div>
prefix=datetime.utcfromtimestamp(timestamp).strftime("T%Y%m%d%H%M")</div>
<div> cdrfiles=glob(kamcdrroot+"*.log")</div>
<div> cdrlist=[]</div>
<div> for cdrfile in cdrfiles:</div>
<div>
newname=kamcdrroot+prefix+cdrfile[cdrfile.rfind("_"):cdrfile.rfind(".")]+".CDT"</div>
<div> cdrlist.append(newname)</div>
<div> mv(cdrfile,newname)</div>
<div> print system("kamcmd flatstore.rotate")</div>
<div> sleep(30)</div>
<div> for cdrfile in cdrlist:</div>
<div> mv(cdrfile,cdrfile[:-1]+"R")</div>
</div>
<div><br>
</div>
<div>so basically the result is the following (i
did a few kamailio restart):</div>
<div><br>
</div>
<div>
<div>root@corex-mc1s:/var/log/kamailio# ls -la</div>
<div>total 328020</div>
<div>drwxrwxrwx 2 root root 4096 déc.
4 13:17 .</div>
<div>drwxr-xr-x 14 root root 4096 déc.
4 13:15 ..</div>
<div>-rw-r--r-- 1 root root 23218 déc.
4 14:23 acc_134.log</div>
<div>-rw-r--r-- 1 root root 21196 déc.
4 14:23 acc_135.log</div>
<div>-rw-r--r-- 1 root root 24509 déc.
4 14:23 acc_136.log</div>
<div>-rw-r--r-- 1 root kamailio 14093392 déc.
4 12:29 T201312041208_129.CDR</div>
<div>-rw-r--r-- 1 root kamailio 14201702 déc.
4 12:29 T201312041208_130.CDR</div>
<div>-rw-r--r-- 1 root kamailio 13882004 déc.
4 12:29 T201312041208_131.CDR</div>
<div>-rw-r--r-- 1 root kamailio 13955029 déc.
4 12:29 T201312041208_132.CDR</div>
<div>-rw-r--r-- 1 root kamailio 4656028 déc.
4 12:29 T201312041208_133.CDR</div>
<div>-rw-r--r-- 1 root kamailio 4587433 déc.
4 12:29 T201312041208_134.CDR</div>
<div>-rw-r--r-- 1 root kamailio 4553151 déc.
4 12:29 T201312041208_135.CDR</div>
<div>-rw-r--r-- 1 root kamailio 4528270 déc.
4 12:29 T201312041208_136.CDR</div>
<div>-rw-r--r-- 1 root kamailio 64318780 déc.
4 12:05 T201312041208_137.CDR</div>
<div>-rw-r--r-- 1 root kamailio 64275486 déc.
4 12:05 T201312041208_138.CDR</div>
<div>-rw-r--r-- 1 root kamailio 64404707 déc.
4 12:05 T201312041208_139.CDR</div>
<div>-rw-r--r-- 1 root kamailio 64222391 déc.
4 12:05 T201312041208_140.CDR</div>
<div>-rw-r--r-- 1 root kamailio 130646 déc.
4 11:53 T201312041208_1.CDR</div>
<div>-rw-r--r-- 1 root kamailio 755148 déc.
4 13:14 T201312041232_129.CDR</div>
<div>-rw-r--r-- 1 root kamailio 778238 déc.
4 13:14 T201312041232_130.CDR</div>
<div>-rw-r--r-- 1 root kamailio 749920 déc.
4 13:14 T201312041232_131.CDR</div>
<div>-rw-r--r-- 1 root kamailio 761826 déc.
4 13:14 T201312041232_132.CDR</div>
<div>-rw-r--r-- 1 root kamailio 11378 déc.
4 13:13 T201312041232_133.CDR</div>
<div>-rw-r--r-- 1 root kamailio 11847 déc.
4 13:09 T201312041232_134.CDR</div>
<div>-rw-r--r-- 1 root kamailio 8599 déc.
4 13:13 T201312041232_135.CDR</div>
<div>-rw-r--r-- 1 root kamailio 11485 déc.
4 13:13 T201312041232_136.CDR</div>
<div>-rw-r--r-- 1 root root 97523 déc.
4 14:24 T201312041316_129.CDR</div>
<div>-rw-r--r-- 1 root root 93268 déc.
4 14:23 T201312041316_130.CDR</div>
<div>-rw-r--r-- 1 root root 91166 déc.
4 14:23 T201312041316_131.CDR</div>
<div>-rw-r--r-- 1 root root 94052 déc.
4 14:23 T201312041316_132.CDR</div>
<div>-rw-r--r-- 1 root root 27300 déc.
4 14:23 T201312041316_133.CDR</div>
<div>-rw-r--r-- 1 root root 770 déc.
4 13:15 T201312041316_134.CDR</div>
<div>-rw-r--r-- 1 root root 378 déc.
4 13:15 T201312041316_135.CDR</div>
<div>-rw-r--r-- 1 root root 765 déc.
4 13:15 T201312041316_136.CDR</div>
<div>-rw-r--r-- 1 root root 8361 déc.
4 14:23 T201312041316_1.CDR</div>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Dec 4, 2013 at
2:07 PM, Daniel-Constantin Mierla <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:miconda@gmail.com"
target="_blank">miconda@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0
0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hello,<br>
<br>
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.<br>
<br>
Cheers,<br>
Daniel
<div>
<div><br>
<br>
<div>On 12/4/13 2:31 PM, Abdelkader
Allam wrote:<br>
</div>
</div>
</div>
<blockquote type="cite">
<div>
<div>
<div dir="ltr">
<div dir="ltr"
style="font-family:arial,sans-serif;font-size:13px">
<div>Hello Guys,</div>
<div><br>
</div>
<div>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, </div>
<div><br>
</div>
<div><br>
</div>
<div>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)</div>
<div><br>
</div>
<div>#!define WITH_ACCFILE</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div># ----- acc params -----</div>
<div>/* what special events
should be accounted ? */</div>
<div>modparam("acc",
"early_media", 1)</div>
<div>modparam("acc",
"report_ack", 1)</div>
<div>modparam("acc",
"report_cancels", 1)</div>
<div>/* by default ww do not
adjust the direct of the
sequential requests.</div>
<div> if you enable this
parameter, be sure the enable
"append_fromtag"</div>
<div> in "rr" module */</div>
<div>modparam("acc",
"detect_direction", 0)</div>
<div>/* account triggers (flags)
*/</div>
<div>modparam("acc", "log_flag",
FLT_ACC)</div>
<div> modparam("acc",
"log_missed_flag",
FLT_ACCMISSED)</div>
<div>modparam("acc",
"log_extra", </div>
<div><span
style="white-space:pre-wrap">
</span>"src_user=$fU;src_domain=$fd;src_ip=$si;"</div>
<div><span
style="white-space:pre-wrap">
</span>"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")</div>
<div>modparam("acc",
"failed_transaction_flag",
FLT_ACCFAILED)</div>
<div>/* enhanced DB accounting
*/</div>
<div>modparam("acc", "db_flag",
FLT_ACC)</div>
<div>modparam("acc",
"db_missed_flag",
FLT_ACCMISSED)</div>
<div>#!ifdef WITH_ACCFILE</div>
<div>modparam("acc", "db_url",
"flatstore:/var/log/kamailio") </div>
<div>modparam("db_flatstore",
"flush", 1)</div>
<div>modparam("acc",
"cdr_enable", 1)</div>
<div>#modparam("acc",
"cdr_flag", 3)</div>
<div>modparam("acc",
"db_extra","ds=$DLG_lifetime")</div>
<div>modparam("acc",
"log_extra",</div>
<div>"src_user=$fU;src_domain=$fd;src_ip=$si;"</div>
<div>"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;"</div>
<div>"duration=$DLG_lifetime")</div>
<div>modparam("acc", "db_extra",</div>
<div>"src_user=$fU;src_domain=$fd;src_ip=$si;" </div>
<div>"dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;"</div>
<div>"duration=$avp(i:256)")</div>
<div><br>
</div>
<div>#!endif</div>
</div>
</div>
<br
style="font-family:arial,sans-serif;font-size:13px">
</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span><font color="#888888">
</font></span></pre>
<span><font color="#888888"> </font></span></blockquote>
<span><font color="#888888"> <br>
<pre cols="72">--
Daniel-Constantin Mierla - <a moz-do-not-send="true" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a moz-do-not-send="true" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
</font></span></div>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio
(OpenSER) - sr-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org"
target="_blank">sr-users@lists.sip-router.org</a><br>
<a moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre cols="72">--
Daniel-Constantin Mierla - <a moz-do-not-send="true" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a moz-do-not-send="true" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
</body>
</html>