[CENTOS] ELK STACK WITH APM - fourslickz/notes GitHub Wiki

INSTALL elasticsearch, kibana, apm-server

elasticsearch

kibana

apm-server

INSTALL AGENT PHP

Instalasi Prasyarat

sudo yum install gcc make php74-php-devel php-pear libcurl-devel -y

Unduh Sumber Kode Agent

git clone https://github.com/elastic/apm-agent-php.git
cd apm-agent-php

Setel Variabel Lingkungan:

export BUILD_ARCHITECTURE=linux-x86-64
export PHP_CONFIG=/opt/remi/php74/root/usr/bin/php-config

Bangun dan Uji Agent:

make -f .ci/Makefile build
PHP_VERSION=$($PHP_CONFIG --version | cut -d'.' -f 1,2) make -f .ci/Makefile run-phpt-tests

Copy extension

cp /opt/elastic/apm-agent-php/agent/native/_build/linux-x86-64-release/ext/elastic_apm_loader.so /opt/remi/php74/root/usr/lib64/php/modules/
cp /opt/elastic/apm-agent-php/agent/native/_build/linux-x86-64-release/ext/elastic_apm-20190902.so /opt/remi/php74/root/usr/lib64/php/modules/

Konfigurasi PHP:

extension=elastic_apm_loader.so
elastic_apm.bootstrap_php_part_file=/opt/elastic/apm-agent-php/src/bootstrap_php_part.php

buat elastic_apm.ini

extension=elastic_apm_loader.so


elastic_apm.bootstrap_php_part_file = /opt/elastic/apm-agent-php/agent/php/bootstrap_php_part.php

elastic_apm.enabled = true
elastic_apm.server_url = "http://10.130.249.225:8200"
elastic_apm.secret_token = ""
elastic_apm.api_key = "STA4aE1aa0JJMW1aOWR6aERDTGI6Q3hqREE4eGV0RGxmTnRmVzROM05pQQ=="   ; pakai encoded di sini
elastic_apm.service_name = "php74-staging"
elastic_apm.environment = "staging"

elastic_apm.log_level = "DEBUG"
elastic_apm.log_file = "/var/log/elastic_apm.log"

Restart PHP-FPM:

sudo systemctl restart php74-php-fpm