iLogtail as the plugin part of Logtail AlibabaCloud can run independently or work with the iLogtail-C. For most cases, the standalone mode is sufficient to verify. If you are familiar with Logtail AlibabaCloud , you can also use cgo mode to verify on Alibaba Cloud.
You can verify your case with the following 3 steps on standalone mode:
The following parts will introduce how the input and processor plugins perform local manual testing with standalone mode.
For input plugins, there may be external dependencies in most cases, so we recommend using E2E to run it, such as E2E nginx. Of course, if you have prepared the dependent environment locally, you can also run it locally. The following example shows the collection of nginx status, and IntervalMs indicates that the acquisition frequency is 1s once. You cloud test the running state with ** TEST_SCOPE=input_nginx TEST_DEBUG=true make e2e** command in the project root path. For the local startup, the collected output is saved in the logtail_plugin.LOG file, that is also cloud be printed to the stdout with ./output/ilogtail --plugin=./demo.json --logger-console=true --logger-retain=false command.
{
"inputs": [
{
"type": "metric_nginx_status",
"detail": {
"IntervalMs": 1000,
"Urls": [
"http://nginx/nginx_status"
]
}
}
],
"flushers": [
{
"type": "flusher_stdout",
"detail": {
}
}
]
}
For the processor plugin, you can use metric_mock or service_mock to mock the collection input. The following example is to verify and test the processor_add_fields plugin function, and metric_mock simulates the collection of input Key/Value data is 1111:2222 pair, the final output contains 3 fields after processor_add_fields processing. For the local startup, the collected output is saved in the logtail_plugin.LOG file, that is also cloud be printed to the stdout with * ./output/ilogtail --plugin=./demo.json --logger-console=true --logger-retain=false* command.
{
"inputs": [
{
"type": "metric_mock",
"detail": {
"Fields": {
"1111": "2222"
}
}
}
],
"processors": [
{
"type": "processor_add_fields",
"detail": {
"Fields": {
"aaa2": "value2",
"aaa3": "value3"
}
}
}
],
"flushers": [
{
"type": "flusher_stdout",
"detail": {
"OnlyStdout": true
}
}
]
}
For ilogtail-GO (this code repository), it can run standalone or work together with ilogtail-C to make Logtail AlibabaCloud. If you are using Logtail AlibabaCloud, the repository can be compiled as an so library to work on the AlibabaCloud. And you cloud use the SLS observable platform to config the settings or view the collect data. The following will introduce how to use AlibabaCloud to run the plugin program written by yourself.
make plugin
to compile so library, and the compiled program is output/libPluginBase.so
.cd /usr/local/ilogtail/
, and stop the [Logtail AlibabaCloud] program with README
guides.libPluginBase.so
program with the compiled libPluginBase.so
program.README
guides.make docker
to compile Logtail AlibabaCloud docker
images named aliyun/ilogtail:2.0.0
.aliyun/ilogtail:2.0.0
to a custom name and push to the remotes, such
as registry.cn-beijing.aliyuncs.com/aliyun/ilogtail:2.0.0
.logtail-ds
of ACK or your self
platform and restart.Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )