Compare languages | The log-shipper module: advanced usage

How to enable debugging logs?

Как включить debug-логи?

Enable the debug parameter of the module.

Включите параметр debug модуля.

yaml apiVersion: deckhouse.io/v1alpha1 kind: ModuleConfig metadata: name: log-shipper spec: version: 1 enabled: true settings: debug: true

Пример конфигурации модуля:

Then in logs, you will find a lot of helpful information about HTTP requests, connects reusing, detailed traces, and so on.

yaml apiVersion: deckhouse.io/v1alpha1 kind: ModuleConfig metadata: name: log-shipper spec: version: 1 enabled: true settings: debug: true

How to get aware of logs pipelines?

После этого в логах вы найдете много полезной информации о HTTP-запросах, переиспользовании подключения, трассировку и т. д.

To begin with, go to the command shell of the Pod on a desired node.

Как узнать больше о каналах передачи log’ов?

bash kubectl -n d8-log-shipper get pods -o wide | grep $node kubectl -n d8-log-shipper exec $pod -it -c vector – bash

Для начала зайдите в под на желаемом узле.

All following commands are assumed to be executed from the Pod’s shell.

bash kubectl -n d8-log-shipper get pods -o wide | grep $node kubectl -n d8-log-shipper exec $pod -it -c vector – bash

See pipelines as a graph

Все следующие команды предполагается запускать из командной оболочки пода.

  • Execute the vector graph command to get the output of logs pipelines topology in the DOT format.
  • Put the output to webgraphviz os similar service to render the graph.

Посмотреть каналы как graph

Example of the graph output for a single pipeline in ASCII format:

  • Выполните команду vector graph, чтобы получить graph в формате DOT.
  • Выставьте его в webgraphviz или другой похожий сервис, чтобы получить изображение.

text +————————————————+ | d8_cluster_source_flant-integration-d8-logs | +————————————————+ | | v +————————————————+ | d8_tf_flant-integration-d8-logs_0 | +————————————————+ | | v +————————————————+ | d8_tf_flant-integration-d8-logs_1 | +————————————————+ | | v +————————————————+ | d8_cluster_sink_flant-integration-loki-storage | +————————————————+

Пример graph’а для одного канала передачи логов в формате ASCII:

Investigate data processing

text +————————————————+ | d8_cluster_source_flant-integration-d8-logs | +————————————————+ | | v +————————————————+ | d8_tf_flant-integration-d8-logs_0 | +————————————————+ | | v +————————————————+ | d8_tf_flant-integration-d8-logs_1 | +————————————————+ | | v +————————————————+ | d8_cluster_sink_flant-integration-loki-storage | +————————————————+

There is the vector top command to help you see how much data is going through all checkpoints of the pipeline.

Отладка передачи данных

Example of the output:

Существует команда vector top, которая поможет увидеть, как много трафика проходит через каждую стадию обработки логов.

Vector TOP output

Пример вывода команды:

Get raw log samples

Vector TOP output

You may use the vector tap command to get input data for any channel components. The only argument to be set is the ID of the processing stage. Patterns in a glob format are also supported for selections (e.g., d8_cluster_source_*).

Получить необработанные образцы log’ов

By using the following command, you can see the log’s before applying the transformation rules (d8_cluster_source_* is the first stage of processing according to the output of the vector graph command):

Вы можете использовать команды vector tap, чтобы получить входные данные для любых компонентов каналов. Единственный аргумент, который нужно задать, — ID стадии обработки (также поддерживаются выборки в формате glob, например cluster_logging_config/*).

bash vector tap ‘cluster_logging_config/*’

С помощью следующей команды вы сможете увидеть логи до применения правил трансформации (cluster_logging_config/* является первой стадией обработки согласно выводу команды vector graph):

Transformed logs that are received at the input of the next channel components in the chain:

bash vector tap ‘cluster_logging_config/*’

bash vector tap ‘transform/*’

Измененные логи, которые поступают на вход следующих в цепочке компонентов каналов:

You can then use the vector vrl interactive console to debug VRL message remap rules.

bash vector tap ‘transform/*’

Example of a program on VRL:

Вы также можете использовать интерактивную консоль vector vrl для отладки VRL правил для изменения логов.

text . = {“test1”: “lynx”, “test2”: “fox”} del(.test2) .

Пример программы с использованием VRL:

How to add a new source/sink support for log-shipper?

text . = {“test1”: “lynx”, “test2”: “fox”} del(.test2) .

Vector in the log-shipper module has been built with the limited number of enabled features (to improve building speed and decrease the size of the final binary).

Как добавить поддержку нового source/sink для log-shipper?

You can see a list of all supported features by executing the vector list command.

Vector для модуля log-shipper был собран с ограниченным набором функций (чтобы уменьшить время сборки и размер финального запускаемого файла).

If supporting a new source/sink is required, you need to add the corresponding feature to the list of enabled features in the Dockerfile.

Вы можете посмотреть весь список поддерживаемых функций, выполнив команду vector list.

 

Если необходимо добавить поддержку нового source/sink, сначала нужно добавить необходимую функцию в список поддерживаемых в Dockerfile.