Skip to content

Commit 0adcc69

Browse files
committed
event_flatstore: add line count-based and size-based rotation, and rotation event
1 parent e9432b1 commit 0adcc69

File tree

3 files changed

+381
-28
lines changed

3 files changed

+381
-28
lines changed

modules/event_flatstore/doc/event_flatstore_admin.xml

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
</itemizedlist>
4949
</para>
5050
</section>
51-
</section>
51+
</section>
5252
<section>
5353
<title>External Libraries or Applications</title>
5454
<para>
@@ -166,6 +166,42 @@ modparam("event_flatstore", "rotate_period", 3660) # rotate every hour
166166
...
167167
</programlisting>
168168
</example>
169+
` </section>
170+
<section id="param_rotate_count" xreflabel="rotate_count">
171+
<title><varname>rotate_count</varname> (int|string)</title>
172+
<para>
173+
Defines after how many written lines the log file is rotated.
174+
The value may exceed the 32-bit integer limit; in that case pass
175+
it <emphasis>as a string</emphasis>, e.g. "5000000000".
176+
</para>
177+
<para><emphasis>Default value is <quote>0/OFF</quote>.</emphasis></para>
178+
<example>
179+
<title>Rotate after five billion lines</title>
180+
<programlisting format="linespecific">
181+
...
182+
modparam("event_flatstore", "rotate_count", "5000000000")
183+
...
184+
</programlisting>
185+
</example>
186+
</section>
187+
<section id="param_rotate_size" xreflabel="rotate_size">
188+
<title><varname>rotate_size</varname> (int|string)</title>
189+
<para>
190+
Sets the maximum size of a file before it is rotated. A size
191+
suffix of <quote>k</quote>, <quote>m</quote> or <quote>g</quote>
192+
(multiples of 1024) may be provided.
193+
Very large values can be supplied as strings, e.g.
194+
"8589934592" for 8 GiB.
195+
</para>
196+
<para><emphasis>Default value is <quote>0/OFF</quote>.</emphasis></para>
197+
<example>
198+
<title>Rotate at 2 GiB</title>
199+
<programlisting format="linespecific">
200+
...
201+
modparam("event_flatstore", "rotate_size", "2g")
202+
...
203+
</programlisting>
204+
</example>
169205
</section>
170206
<section id="param_suffix" xreflabel="suffix">
171207
<title><varname>suffix</varname> (string)</title>
@@ -223,11 +259,48 @@ modparam("event_flatstore", "suffix", "$time(%Y)")
223259
<para>
224260
MI FIFO Command Format:
225261
</para>
226-
<programlisting format="linespecific">
227-
opensips-cli -x mi evi_flat_rotate _path_to_log_file_
262+
<programlisting format="linespecific">
263+
...
264+
opensips-cli -x mi evi_flat_rotate _path_to_log_file_
265+
...
228266
</programlisting>
229267
</section>
230-
</section>
231-
</chapter>
268+
</section>
269+
270+
<section id="exported_events" xreflabel="Exported Events">
271+
<title>Exported Events</title>
232272

273+
<section id="event_E_FLATSTORE_ROTATION" xreflabel="E_FLATSTORE_ROTATION">
274+
<title>
275+
<function moreinfo="none">E_FLATSTORE_ROTATION</function>
276+
</title>
233277

278+
<para>
279+
The event is raised every time <emphasis>event_flatstore</emphasis>
280+
opens a new log file (manual <command>evi_flat_rotate</command>,
281+
auto-rotate by <varname>rotate_period</varname>, or
282+
thresholds <varname>rotate_count</varname>/<varname>rotate_size</varname>).
283+
External apps can subscribe to monitor log-rotation activity.
284+
</para>
285+
286+
<para>Parameters:</para>
287+
<itemizedlist>
288+
<listitem><para>
289+
<emphasis>timestamp</emphasis> – Unix epoch (seconds) when the
290+
rotation was performed.
291+
</para></listitem>
292+
<listitem><para>
293+
<emphasis>reason</emphasis> – one of the strings
294+
<emphasis>count</emphasis>, <emphasis>size</emphasis>,
295+
<emphasis>period</emphasis> or <emphasis>mi</emphasis>.
296+
</para></listitem>
297+
<listitem><para>
298+
<emphasis>filename</emphasis> – full path of the new log file.
299+
</para></listitem>
300+
<listitem><para>
301+
<emphasis>old_filename</emphasis> – full path of the previous log file.
302+
</para></listitem>
303+
</itemizedlist>
304+
</section>
305+
</section>
306+
</chapter>

0 commit comments

Comments
 (0)