Filebeat
Using filebeat to send the logs to PacketAI
Download the Filebeat
Linux
Download the filebeat using below bash script: https://www.elastic.co/downloads/past-releases/filebeat-8-4-3
Windows
Download the filebeat using Powershell script:
Configure Filebeat
Edit the filebeat.yml, use the below filebeat configuration, we need to customise this according to your requirements, explained in details about each section below. The complete filebeat configuration can be found here
filebeat.inputs
:
This section is to monitor the list of log files on your host. we need to mention the
paths
which takes array of files with regular expression (glob), make sure thatid
is unique, and set theenabled
to true to start the monitoring of the log lines.We could define the
appName
to each log file, this can be helpful to filter the logs at packetai. When we set thetail_files
totrue
for not sending the logs from the beginning of the log file. Heretype: filestream
defines that this is a filestream type monitoring.filebeat.inputs
is an array where we could monitor multiple log files.
output.elasticsearch
:
hosts
: Make sure that your hosts entries are correct.hosts: ["beats-ingester-logpatterns.packetai.co:443"]
change if your PacketAI API's are differentcompression_level is between 0 to 9, 0 being no compression at all, and 9 being best compression, we would suggest to use the value 6. higher compression values means higher cpu usage and lower network usage.
headers
sub section needs to update according to you PAI_IID and PAI_TOKEN. you can get them on packetai after login, and under the section ofDeploy PacketAI / Agent
processors:
We need to modify the YOUR_CLUSTER_NAME with appropriate cluster name. clusterName can be used to manage the retention period on PacketAI managed.
add_cloud_metadata: ~ is optional, this adds the metadata of the cloud. i.e. region, zone, machine_id etc...
add_docker_metadata is optional, this also docker metadata, docker container name, image name, docker labels, etc.... This extra metadata will increase the index size at PacketAI.
Installation of Filebeat
Linux:
We could run the filebeat with the below command to start the filebeat, we need to install a service, if we want to automatically start the filebeat service on system startup.
systemd service file (filebeat.service
): Here we are assuming that filebeat is located at /opt/filebeat, if the filebeat is located somewhere please update the filebeat.service file to reflect the same.
copy the file to /etc/systemd/system
directory, and run the below commands. In
Windows:
In order to install the filebeat on Windows, we need to run the below command, in filebeat folder.
Last updated
Was this helpful?