en:ipfixreceiver [Документация VAS Experts]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:ipfixreceiver [2017/03/09 10:13] – [Important changes in version 1.0.3 vs 1.0.2] aalekseenkoen:ipfixreceiver [2019/02/13 16:32] (current) – removed lexx26
Line 1: Line 1:
-====== IPFIX receiver utility ====== 
-===== Introduction ===== 
  
-IPFIX receiver is used for receiving an IPFIX (Netflow 10) stream from DPI devices and store the stream to a local file. The stored file can be processed as a text file any unix utilities. 
- 
-===== Installation and upgrade ===== 
-  - use VAS Experts repositore according to p.1 of the [[dpi_10_update|DPI installation instruction]]. 
-  - install ipfixreceiver:\\ <code>yum install -y ipfixreceiver</code> 
-  - check changes in configuration files for installed version look at part "Important changes in version ..." 
- 
-===== Important changes in version 1.0.3 vs 1.0.2 ===== 
-  - chenged configuration file in part of IP address transformation, since 1.0.3 version use decodeipv4, decodeipv6 in Export model to exoprt IP in readable mode. Example:<code>  source_ip4, decodeipv4</code><code>  destination_ip4, decodeipv4</code> 
-  - saving data now in separate process, important if DPI has more than 25 000 session per second, it can load upto 2 proccesor cores. In DEBUG loging added check records to controll save processing\\ (a)cnt=NNNNN - send NNNNN buffer\\ (b)cnt=YYYYY - saved YYYYY buffer. 
-  - buffer_size parameter added - size of buffer to interchange between receiver and saver processes, use it in [dump] section, default value - 100000 records (for 20Gbe or 25 000 seesion per second). If the buffer size is not reached then 30sec timeout is used to push buffer into saver process.  
- 
-===== Supplied files ===== 
-  - configuration expamples:\\ <code>/etc/dpiui/ipfixreceiver.conf - clickstream example (http/https clickstream) 
-/etc/dpiui/ipfixreceiverflow.conf - session example (netflow 10/IPFIX full session export) 
-/etc/dpiui/ipfixreceiversip.conf - meta information (sip connections) example </code> 
-  - programm files directory:\\ <code>/usr/local/lib/ipfixreceiver.d/</code> 
-  - additional files:\\ <code>/etc/dpiui/port_proto.txt - for translation protocol number to text protocol name</code> 
-  - link to executable:\\ <code>/usr/local/bin/ipfixreceiver -> link to /usr/local/lib/ipfixreceiver.d/ipfixreceiver</code> 
- 
-===== Additional OS settings ===== 
-  - set iptables for receive external data\\ Ipfixreceiver is requred to open ports that will be used to receive IPFIX streams (in configuration see section [connect])\\ For instance you  are using TCP protocol, 1500 port and IP=212.12.11.10\\ <code>[connect] 
-protocol=tcp 
-host=212.12.11.10 
-port=1500</code>\\ For ipfixreceiver working in /etc/sysconfig/iptables you have to insert the next rule:\\ <code>-A INPUT -p tcp -m state --state NEW -m tcp --dport 1500 -j ACCEPT</code> Do not forget that after changes iptables r - restart service is requried:\\ <code>service iptables restart</code>  
-  - configure logrotate\\ Example for logrotate file /var/log/dpiuiflow.log, create in /etc/logrotate.d/ the file "flowlog" with the next content <code> 
-/var/log/dpiui*.log { 
-    rotate 5 
-    missingok 
-    notifempty 
-    compress 
-    size 10M 
-    daily 
-    copytruncate 
-    nocreate 
-    postrotate 
-    endscript 
-}</code> \\ Using copytruncate is requred, otherwise the log file will be recreated and log write to the file in stopped.\\ According to ipfixreceiver configuration in section [handler_ipfixreceiverlogger] is setted the next:\\ <code>args=('/var/log/dpiuiflow.log', 'a+')</code> 
-  - configure remove old files. Example, removing old archive files (more then 31 days) with session records in gzip:\\ <code>15 4 * * * /bin/find /var/dump/dpiui/ -name url_\*.dump.gz -cmin +44640 -delete > /dev/null 2>&1</code>\\ Change it to meet you requirements and put into the file /var/spool/cron/root. 
- 
-===== Execution parameters ===== 
-ipfixreceiver utility has next parameters: 
-<code>usage: ipfixreceiver start|stop|restart|status|-v [-f <config file>] 
-где 
-  start   - start as service 
-  stop    - stop service 
-  state   - get state of service 
-  restart - restart service 
-  -v      - version info 
-  -f <config file> - config file name (required) 
- 
-Example: 
-  ipfixreceiver start -f /etc/dpiui/ipfixreceiverflow.conf 
-</code> 
-===== Configuration ===== 
- 
-By default config file /etc/dpiui/ipfixreceiver.conf is used .\\  
-:!:More information about config parameter you can find by link [[https://docs.python.org/2.6/library/logging.html | Logging ]] 
- 
-==== Logging sections ==== 
-  - loggers - define logging identifiers 
-  - handlers - define used logging workers 
-  - formatters - define used logging formats 
- 
-==== logger_root ==== 
-  - level - log level\\ Values:<code> 
-CRITICAL  - critical errors only, minimum log level 
-ERROR     - errors included 
-WARNING   - warnings included 
-INFO      - information included 
-DEBUG     - debug messages included 
-NOTSET    - all, maximum log level 
-</code>\\ Example:\\ <code>level=DEBUG</code> 
-  - handlers - used message handlers\\ Example: <code>handlers=ipfixreceiverlogger</code> 
-==== handler_ipfixreceiverlogger ==== 
-  - class - class of the message handler\\ Example: <code>class=FileHandler</code> 
-  - level - log level <code>level=DEBUG</code> 
-  - formatter - name of formatter that is used<code>formatter=ipfixreceiverlogger</code> 
-  - args - handlers' parameters <code>args=('/var/log/dpiuiflow.log', 'a+')</code> 
-==== formatter_ipfixreceiverlogger ==== 
-  - format - log message format description\\ Example: <code>format=%(asctime)s - %(name)s - %(levelname)s - %(message)s 
-here: 
-%(name)s      - logger name 
-%(levelname)s - level ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'). 
-%(asctime)s   - daye, default - “2003-07-08 16:49:45,896” (with milliseconds after comma). 
-%(message)s   - message 
-</code> 
-  - datefmt - date format\\ Example: <code>datefmt='%m-%d %H:%M'</code> 
-==== connect ==== 
-  - protocol - protocol(tcp or udp). <code>protocol=udp</code> 
-  - host - IP or server name or 0.0.0.0 (to receive from all devices). <code>host=localhost</code> 
-  - port - port number. <code>port=9996</code> 
-==== dump ==== 
-  - rotate_minutes - rotation period in minuties, after it temp file will be moved to dumpfiledir/<port>.url.dump and new tempfile will be created.<code>rotate_minutes=10</code> 
-  - processcmd - command that will be executed to process new data file after rotation, parameter is full file name.<code>processcmd=gzip %%s</code> 
-  - dumpfiledir - directory where received data files will be stored. <code>dumpfiledir=/var/dump/dpiui/ipfixflow/</code> 
-  - buffer_size - size of buffer to interchange between receiver and saver processes, use it in [dump] section, default value - 100000 records (for 20Gbe or 25 000 seesion per second). If the buffer size is not reached then 30sec timeout is used to push buffer into saver process.  
- 
-==== InfoModel ==== 
-Блок описывает получаемые данные по IPFIX протоколу. 
-  - InfoElements - параметр с описанием элементов информационной модели для IPFIX <code>InfoElements =  octetDeltaCount,       0,    1, UINT64, True 
-                packetDeltaCount,      0,    2, UINT64, True 
-                protocolIdentifier,    0,    3, UINT8 
-                session_id,        43823, 2000, UINT64, True 
-где, 
-  session_id - наименование поля из описания IPFIX см. разделы 
-  43823  - уникальный номер организации (enterprise number) 
-  1      - уникальный номер поля 
-  UINT64 - тип поля 
-  True   - использовать обратный порядок байт (endian). Значения - True или пусто. 
-</code> 
-Типы полей:\\ 
-^ Type      ^ Length       ^ Type IPFIX          ^ 
-| OCTET_ARRAY    | VARLEN     | octetArray        | 
-| UINT8          | 1          | unsigned8         | 
-| UINT16         | 2          | unsigned16        | 
-| UINT32         | 4          | unsigned32        | 
-| UINT64         | 8          | unsigned64        | 
-| INT8           | 1          | signed8           | 
-| INT16          | 2          | signed16          | 
-| INT32          | 4          | signed32          | 
-| INT64          | 8          | signed64          | 
-| FLOAT32        | 4          | float32           | 
-| FLOAT64        | 8          | float64           | 
-| BOOL           | 1          | boolean           | 
-| MAC_ADDR       | 6          | macAddress        | 
-| STRING         | VARLEN     | string            | 
-| SECONDS        | 4          | dateTimeSeconds   | 
-| MILLISECONDS   | 8          | dateTimeMilliseconds | 
-| MICROSECONDS   | 8          | dateTimeMicroseconds | 
-| NANOSECONDS    | 8          | dateTimeNanoseconds  | 
-| IP4ADDR        | 4          | ipv4Address       | 
-| IP6ADDR        | 16         | ipv6Address       | 
- 
-Наименование полей и описание можно взять по ссылкам:\\ 
-  - [[statistics_ipfix|Шаблон экспорта Netflow в формате IPFIX]] 
-  - [[li_ipfix|Шаблоны экспорта clickstream и SIP]] 
- 
-Дополнительная информация:\\ 
-[[https://tools.ietf.org/html/rfc5102.html | Information Model for IP Flow Information Export]] 
-==== ExportModel ==== 
-определяет параметры модели для экспорта, зарезервировано для будущего использования. 
-  - Mode - тип используемого экспорта <code>Mode = File</code> 
-==== ExportModelFile ==== 
-Описание модели экспорта File. 
-  - Delimiter разделитель полей в строке ( \t - табуляция, еще примеры - |,;) <code>Delimiter = \t</code> 
-  - ExportElements - описание полей которые будут сохранены в файл. <code>ExportElements = timestamp, seconds, %%Y-%%m-%%d %%H:%%M:%%S.000+03 
-                 login 
-                 source_ip4 
-                 destination_ip4 
-                 host, decodehost 
-                 path, decodepath 
-                 referal, decodereferer 
-                 session_id 
-где поля в каждой строке: 
-  имя - наименование поля из информационной модели [InfoModel] (login, session_id и т.п.) 
-  обработчик - процедура обработки поля перед выводом 
-               seconds       - поле в секундах, ожидается формат 
-               milliseconds  - поле в милисекундах, микросекундах, наносекундах ожидается формат 
-               decodehost    - перекодировать из punycode в UTF-8 
-               decodepath    - перекодировать из urlencoding в UTF-8 
-               decodereferer - перекодировать из (punycode,urlencoding) в UTF-8 
-               decodeproto   - перекодировать идентификатор протокола в строку 
-  формат - описание формата для seconds, milliseconds.  
-           Пример: %%Y-%%m-%%d %%H:%%M:%%S.%%f+0300 
-           Результат: 2016-05-25 13:13:35.621000+0300 
-</code> 
-===== Проблемы и решения ===== 
-  - как получить версию утилиты?\\ Используйте следующие команды:\\ <code>ipfixreceiver -v</code><code>yum info ipfixreceiver</code> 
-  - можно ли на один порт отправлять IPFIX потоки с разных DPI?\\ Да. Единственное в записываемом потоке их будет не различить. 
-  - как понять, что утилита работает?\\ a) проверьте, что порт из конфигурации прослушивается утилитой, например 1500:<code>netstat -nlp | grep 1500</code> b) проверьте лог, нет ли ошибок\\ c) Проверьте, что запись в промежуточный файл происходит, например для 9996 порта (директория для файлов - /var/dump/dpiui/ipfixurl): <code>tail -f /var/dump/dpiui/ipfixurl/9996.url.dump</code> 
-  - все проверено, но приема сообщений нет?\\ a) забыли открыть порт в iptables.\\ b) инициализировали ipfixreceiver с неверным IP сервера. 
-  - с DPI идет большое количество сессий (более 2 млн сессий/мин), при включенном DEBUG режиме видно, что счетчик обмена буферами не успевает записать до получения следующего блока записей, что можно сделать?\\ a) удалите преобразование даты в строку, это уменьшит процессорное время на обработку и дополнительно получите уменьшение объема результирующего файла\\ b) удалите преобразование decodeipv4, не значительно, но так же получите ускорение записи файла\\ c)настройте buffer_size при к-ве сес /сек более 30к совместно с п.d\\ d) увеличьте частоту процессора и объем памяти