Magento

Magento screenshot 1
Magento screenshot 2
Magento screenshot 3

Dashboard uses Loki and Promtail to scrape Magento 2, Nginx / Apache logs and PHP-FPM.

Logs

  • Magento 2:

    • var/log/system.log
    • var/log/exception.log
    • var/reports/*
  • Server Logs:

    • access.log
    • error.log
    • php-fpm.log

Nginx Log Formatting

log_format '$remote_addr - $remote_user [$time_local] '
           '"$request" $status $body_bytes_sent '
           '"$http_referer" "$http_user_agent"';

Promtail example config

server:
  http_listen_port: 9080
  grpc_listen_port: 0
  http_listen_address: 127.0.0.1

positions: filename: /opt/promtail/positions.yaml

clients:

  • url: http://loki-endpoing:3100/loki/api/v1/push

scrape_configs:

  • job_name: magento_exception_log pipeline_stages:

    • multiline: firstline: '[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}+\d{2}:\d{2})]' max_wait_time: 5s static_configs:
    • targets:
      • localhost labels: engine: magento log_type: exception brand: mybrand service: magento path: /path/to/var/log/exception.log
  • job_name: magento_system_log pipeline_stages:

    • multiline: firstline: '[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}+\d{2}:\d{2})]' max_wait_time: 5s static_configs:
    • targets:
      • localhost labels: engine: magento log_type: system brand: mybrand service: magento path: /path/to/var/log/system.log
  • job_name: magento_report static_configs:

    • targets:
      • localhost labels: engine: magento log_type: report brand: mybrand service: magento path: /path/to/var/report/*
  • job_name: web_access static_configs:

    • targets:
      • localhost labels: engine: magento log_type: web_access brand: mybrand service: nginx path: /var/log/nginx/mybrand-access.log
  • job_name: web_error static_configs:

    • targets:
      • localhost labels: engine: magento log_type: web_error brand: mybrand service: nginx path: /var/log/nginx/mybrand-error.log
  • job_name: phpfpm static_configs:

    • targets:
      • localhost labels: engine: magento log_type: phpfpm brand: mybrand service: phpfpm path: /var/log/php-fpm.log
Revisions
RevisionDescriptionCreated

Get this dashboard

Import the dashboard template

or

Download JSON

Datasource
Dependencies