Filebeat System
Ship system logs to Logstash using Filebeat
Follow the steps below to send your observability data to Logit.io
Logs
Filebeat is an open source shipping agent that lets you ship logs from local files to one or more destinations, including Logstash.
Install Integration
Install Filebeat
To get started you will need to install filebeat. To do this you have two main options:
- Choose the AMD / Intel file (x86_64) or
- Choose the ARM file (arm64)
You can tell if you have a Linux PC with an AMD / Intel CPU (kernel) architecture by opening a terminal and running the uname -m
command. If it displays x86_64 you have AMD / Intel architecture.
To successfully install filebeat you will need to have root access.
If you have an x86_64 system download and extract the contents of the file using the following commands:
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.15.2-linux-x86_64.tar.gz
tar xzvf filebeat-8.15.2-linux-x86_64.tar.gz
If you have an arm64 system download and extract the contents of the file using the following commands:
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.15.2-linux-arm64.tar.gz
tar xzvf filebeat-8.15.2-linux-arm64.tar.gz
Enable The System Module
There are several built in filebeat modules you can use. You will need to enable the system module.
Change directory to the location where filebeat was extracted and run the following commands:
sudo chown root filebeat.yml
sudo chown root modules.d/*.yml
sudo ./filebeat modules list
sudo ./filebeat modules enable system
sudo chown root module/system/syslog/*.yml
sudo chown root module/system/auth/*.yml
Navigate to the modules.d
folder, copy the snippet below and replace the contents of the system.yml module file:
# Module: system
# Docs: https://www.elastic.co/guide/en/beats/filebeat/8.12/filebeat-module-system.html
- module: system
syslog:
enabled: true
# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths: ["/path/to/log/syslog*"]
# Authorization logs
auth:
enabled: true
# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths: ["/path/to/log/auth.log*"]
Update your configuration file
The configuration file below is pre-configured to send data to your Logit.io Stack via Logstash.
Copy the configuration file below (making the above changes as necessary) and overwrite the contents of filebeat.yml (this file can be found in the location where you installed Filebeat in the previous step).
Filebeat modules offer the quickest way to begin working with standard log formats. If you opt to configure Filebeat manually rather than utilizing modules, you'll do so by listing inputs in the filebeat.inputs section of filebeat.yml. These inputs detail how Filebeat discovers and handles input data.
###################### Logit.io Filebeat Configuration ########################
# ============================== Filebeat inputs ==============================
filebeat.inputs:
- type: filestream
enabled: true
id: my_unique_id
paths:
# REQUIRED CHANGE TO YOUR LOGS PATH
- /var/log/*.log
fields:
type: logfile
# ============================== Filebeat modules ==============================
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
#reload.period: 10s
# ================================== Outputs ===================================
# ------------------------------ Logstash Output -------------------------------
output.logstash:
hosts: ["@logstash.host:@logstash.sslPort"]
loadbalance: true
ssl.enabled: true
# ================================= Processors =================================
processors:
- add_host_metadata:
when.not.contains.tags: forwarded
- add_cloud_metadata: ~
- add_docker_metadata: ~
- add_kubernetes_metadata: ~
Validate Configuration
sudo ./@beatname test config -c @beatname.yml --strict.perms=false
You'll be running as root, so you need to change ownership of the
configuration file and any configurations enabled in the modules.d directory, or
run with --strict.perms=false
as shown above. Read more about how to
change ownership.
If the yml file is invalid, @beatname will print a description of the error. For example, if the
output.logstash
section was missing, @beatname would print no outputs are defined, please define one under the output section
Start filebeat
To start Filebeat, run:
sudo chown root filebeat.yml
sudo chown root modules.d/system.yml
sudo ./filebeat -e
You'll be running filebeat as root, so you need to change ownership of the configuration file and any configurations enabled in the modules.d directory, or run filebeat with --strict.perms=false as shown above.
Read more about how to change ownership (opens in a new tab).
Check Logit.io for your logs
Data should now have been sent to your Stack.
View My DataIf you don't see take a look at How to diagnose no data in Stack below for how to diagnose common issues.
How to diagnose no data in Stack
If you don't see data appearing in your stack after following this integration, take a look at the troubleshooting guide for steps to diagnose and resolve the problem or contact our support team and we'll be happy to assist.