Using Vector agent
This document describes how to send logs to PacketAI using the vector agent.
Setting keys, cluster name and access control
In order to complete the setup, there are 2 main things to configure :
Obtain your keys YOUR_PAI_TOKEN and YOUR_PAI_IID by going to https://logpatterns.packetai.co/deploy/agent. Pick any of the integrations to find your keys.
Replace
yourclustername
with your cluster name in the Transformer block (see below). ⚠️Note that even if you are not using a proper cluster, you must provide a value for this variable.
Setting Source
Packetai requires a data source to send logs. So the first step is to configure a (Vector’s) source object.
As an example, here is how to setup a source of type“file”
that sends log files located in 2 folders:
A second example shows how to setup a source of type “kubernetes_logs”
- please note that additional configuration parameters are generally needed
Please refer to https://vector.dev/docs/reference/configuration/sources to learn more about setting up the source of your choice.
Setting Transformer
Packetai provides a transformer that can be used to transform the data before it is ingested. Please note that for API compatibility reasons the transformer must create a {kubernetes.controller.{name,type},namespace}
JSON object -even if you are not using kubernetes, else log patterns would fail to display.
As an example, here is a transformer for file logs:
As an example, here is a transformer for GCP logs:
Just below, finalize the transformer block with the snippet below. ⚠️Please note to replace yourclustername
in the snippet below -even if you are not using a proper cluster, you must provide a value for this variable.
Setting Sink
Finally, a sink object must be configured. This sink object (an HTTP in Packetai’s case) will be the destination to which logs are sent. ⚠️Please note to replace YOUR_PAI_TOKEN
and YOUR_PAI_IID
in the snippet below.
Validate your configuration
It is advised to test and validate your pipeline configuration by using the following stdout
sink, before using the final sink defined above.
Once there are no more errors and JSON messages display as expected, you can switch to the final sink: within minutes, you should see your first logs on https://logpatterns.packetai.co/logs !
Last updated
Was this helpful?