
Introduction
We will set up Logstash as our Application Performance Monitoring (APM) server. We have used Logstash before, so for a more indepth tutorial on Lgostash, see here.
Download Code: Available on Github
Requirements
We use two different linux server:
- APM logging server: ubuntu 24.04, 1gb memory
- app server: ubuntu 24.04, 1gb memory
Steps
Step 1 - Update Ubuntu
The Ubuntu installations are brand new. We update the distribution as well as install some tools we typically use on both machines.
apt-get update && apt dist-upgrade -y && apt-get install -y vim curl zip jq gnupg gpg
Step 2 - Install Logstash
The Ubuntu installations needs these dependencies, so run these commands on both:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/9.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-9.x.list
apt-get update;
apt-get install -y apt-transport-https;
apt-get install -y logstash;
Step 3 - Start Logstash Service for APM Data
cat > /etc/logstash/conf.d/apm.conf <<'EOL' input { elastic_agent { port => 5044 } } output { file { path => '/var/log/logstash/apm.txt' } } EOL systemctl enable logstash systemctl start logstash
Step 4 - Install APM Agent
curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-9.1.4-linux-x86_64.tar.gz tar xzvf apm-server-9.1.4-linux-x86_64.tar.gz cat > ~/apm-server-9.1.4-linux-x86_64/apm-server.yml <<'EOL' apm-server: host: '0.0.0.0:8200' secret_token: 'abcd1234' output.logstash: enabled: true hosts: ['ip.of.apm-logging.server:5044'] ssl.enabled: false logging.level: error EOL cd ~/apm-server-9.1.4-linux-x86_64 chown -R root:root . ./apm-server
For the apm-server.host
, the 0.0.0.0
is very permissive. Consider using the actual ip address of the server or 127.0.0.1
if it is just localhost.
Step 5 - Install Application
See the Testing Applications of the Beginner's Guide to install and test APM.