Debian Codegraph @

src/modules/db_flatstore/README

raw
1 Db_flatstore Module
2
3 Jan Janak
4
5 FhG FOKUS
6 <[email protected]>
7
8 Julien Chavanton
9
10 Flowroute
11 <[email protected]>
12
13 Copyright © 2004, 2005 FhG FOKUS
14
15 Copyright © 2017 Flowroute
16 __________________________________________________________________
17
18 Table of Contents
19
20 1. Admin Guide
21
22 1. Overview
23
24 1.1. Rotating Log Files
25
26 2. Parameters
27
28 2.1. flush (integer)
29 2.2. encode_delimiter (integer)
30
31 Chapter 1. Admin Guide
32
33 Table of Contents
34
35 1. Overview
36
37 1.1. Rotating Log Files
38
39 2. Parameters
40
41 2.1. flush (integer)
42 2.2. encode_delimiter (integer)
43
44 1. Overview
45
46 1.1. Rotating Log Files
47
48 Db_flatstore is one of the Kamailio database modules. It does not
49 export any functions executable from the configuration scripts, but it
50 exports a subset of functions from the database API and thus other
51 modules can use it as a database driver, instead of, for example, the
52 db_mysql module.
53
54 The module does not implement all functions of the database API, it
55 supports only one function, insert. This means that the module is
56 limited but very fast. It is especially suitable for storing accounting
57 information on sites with extremely high traffic. If MySQL is too slow
58 or if you get a huge amount of accounting data then you can consider
59 using this module. Please note that the acc module is the only module
60 that was tested with the flatstore module.
61
62 The format of the files produced by this module is plain text. Each
63 line consists of several fields, fields are separated by the "|"
64 character (vertical bar). New information is always appended at the end
65 of the file. Searching, deleting and updating of existing data is not
66 supported by the module.
67
68 The acc module can be configured to use db_flatstore module as database
69 backend using the db_url_parameter:
70 modparam("acc", "db_url", "flatstore:/var/log/acc")
71
72 This configuration option tells the acc module that it should use the
73 db_flatstore module and the db_flatstore module should create all files
74 in the /var/log/acc directory. The directory must exist and Kamailio
75 processes must have permissions to create files in that directory.
76
77 Name of files in that directory will follow the following pattern:
78 <table_name>_<process_name>.log
79
80 For example, entries written by the Kamailio process 8 into the acc
81 table would be written in file acc_8.log. For each table there will be
82 several files, one file for every Kamailio process that wrote some data
83 into that table. The main reason why there are several files for each
84 table is that it is much faster to have one file per process, because
85 it does not require any locking and thus Kamailio processes will not
86 block each other. To get the complete data for a table you can simply
87 concatenate the contents of files with the same table name but
88 different process id.
89
90 1.1. Rotating Log Files
91
92 The module implements a Kamailio management interface command called
93 flatstore.k_rotate. When Kamailio receives the command it will close
94 and reopen all files used by the db_flatstore module. The rotation
95 itself has to be done by another application (such as logrotate).
96 Follow these steps to rotate files generated by the db_flatstore
97 module:
98 * Rename the files that you want to rotate:
99 cd /var/log/acc
100 mv acc_1.log acc_1.log.20050605
101 mv acc_2.log acc_2.log.20050605
102 mv acc_4.log acc_3.log.20050605
103 ...
104 Note that at this point Kamailio will still be writing all data
105 into the renamed files.
106 * Send Kamailio the management command to close and reopen the
107 renamed files:
108 kamcmd flatstore.k_rotate
109 This will force Kamailio to close the renamed files and open new
110 ones with original names, such as acc_1.log. New files will be open
111 at the point when Kamailio has some data to write. It is normal
112 that the files will be not created immediately if there is no
113 traffic on the SIP server.
114 * Move the renamed files somewhere else and process them.
115
116 2. Parameters
117
118 2.1. flush (integer)
119 2.2. encode_delimiter (integer)
120
121 2.1. flush (integer)
122
123 Enable or disable flushing after each write.
124
125 Default value is 1.
126
127 2.2. encode_delimiter (integer)
128
129 Enable or disable encoding of the escaped character using ""%" HEX HEX"
130 mechanism for escaping from RFC 2396
131
132 Default value is 1. Default delimiter '|' is replaced with %7C if found
133 in any string