Using Logstash agent

This document describes how to send logs to PacketAIarrow-up-right using the logstash http output plugin

Setting keys, cluster name and access control

In order to complete the setup, there are 2 main things to configure :

  1. Obtain your keys YOUR_PAI_TOKEN and YOUR_PAI_IID by going to https://logpatterns.packetai.co/deploy/agentarrow-up-right. Pick any of the integrations to find your keys.

  2. Replace yourclustername with your cluster name in the mutate block (see below). ⚠️Note that even if you are not using a proper cluster, you must provide a value for this variable.

Input conf

Logstash supports several input plugins, the list of input plugins it supports can be found herearrow-up-right. The following file input configuration is provided as an example.

input { 
    file {
        path => [
            "/var/log/*.log",
            "/var/log/*/*.log"
        ]
    }
}

Filter conf

Logstash supports several plugins for filtering logs, the more details about several filters (plugins) available herearrow-up-right. PacketAI needs some additional fields needs to be attached to each message, see the below mutate section. We need to map the each application message to the following field, [kubernetes][controller][name] . for example if we have field application_name in the message, we could map [kubernetes][controller][name] => [application_name]. The following fields can be static

Output conf

Logstash several output plugins, more details can be found herearrow-up-right. PacketAI use http output plugin of logstash to send the messages to packetai. The http output plugin code snippet can be found below. we need to replace the YOUR_PAI_TOKEN_HERE and YOUR_PAI_IID_HERE with the correct values.

Sample logstash configuration

Please replace the YOUR_PAI_TOKEN_HERE and YOUR_PAI_IID_HERE with the correct values from the PacketAI account.

Validate your configuration

It is advised to test and validate your logstash configuration with below command

Last updated

Was this helpful?