Kibana filters and useful CLI commands

Service logs available in Kibana and their filter queries

Cron

*.container.name : "cron"

ElasticSearch

*.container.name : "elasticsearch"

Application

*.container.name : "app-fe"
*.container.name : "app-be"

Redis

*.container.name : "redis"

Nginx

*.container.name : "nginx"

If you see that your logs are duplicated, then keep in mind that nginx has many server blocks in its configuration, so one or more of the same internal requests may be added to the external request, and each of them will be logged. If you want to filter only external requests without showing duplicates, then use the following query:

*.container.name : nginx and server_port: 80

MySQL

*.container.name : "mysql"

Deployment and build logs in Kibana

Build logs

Build logs are only recorded in Kibana if the build failed.

*.container.name : "build"

Deployment logs

*.container.name : "app-updater"

system.log in Kibana

(*.container.name : "app" or *.container.name : "cron") and (message : "main.ERROR" or message: "main.NOTICE" or message: "main.INFO" or message: "main.DEBUG") 

exception.log in Kibana

(*.container.name.keyword : "app" or *.container.name : "cron") and message: "main.CRITICAL" 

cron.log in Kibana

*.container.name.keyword : "cron"

Create database dump

  1. Grant SSH access via the User Portal following the instructions.

  2. Connect to the environment using created SSH access.

  3. Create a database dump on the server:

    mysqldump magento --single-transaction --no-tablespaces | zip dump.sql.gz -
  4. Exit SSH.

  5. Copy the database dump locally:

    scp {ssh_user}@ssh.readymage.com:/home/magento/dump.sql.gz .

Replace the database with a database dump

  1. Grant SSH access via the User Portal following the instructions.

  2. Place database dump on the server by running:

    scp {local_path_to_db} {ssh_user}@ssh.readymage.com:/home/magento/dump.sql
  3. Connect to the environment using created SSH access.

  4. Replace the database with your dump file:

    mysql magento < dump.sql

Copy media data from local to SSH container

You can only copy media to /home/magento directory.

rsync -azP media/ your-user@ssh.readymage.com:/home/magento/media/

Copy media data from SSH container to local

rsync -azP your-user@ssh.readymage.com:/home/magento/media/

Connect to MySQL database

  1. Grant SSH access via the User Portal following the instructions.

  2. Connect to the environment using created SSH access.

  3. Connect to MySQL database:

    SSH - "mysql"

View Magento reports stored in var/reports

Use the following command when connected to SSH to list all available reports:

ls -l var/report/

Use the following command when connected to SSH to view the specific report:

cat var/report/{report_name}

Resolve stuck deployment

Identify the problem by checking deployment and build logs and try redeploying the instance following the instructions here.

Reindex commands

  1. Grant SSH access via the User Portal following the instructions.

  2. Connect to the environment using created SSH access.

  3. Check reindexing status:

    php bin/magento indexer:info
    php bin/magento indexer:status
  4. Perform reindex

    php bin/magento indexer:reindex
  5. Reset reindex

    php bin/magento indexer:reset

Files that are copied to ReadyMage during deployment

  • src/composer.json

  • src/composer.lock

  • src/app/

  • src/pub/.well-known

  • src/pub/google*.html

Content Security Policy control

Content security policies are controlled on Magento 2 application level.

Clear cache

Via Magento admin

System > Tools > Cache Management > Flush Cache Storage and Flush Magento Cache.

SSH

php bin/magento c:f

Cloudflare

Dashboard > Settings > Purge Cache

Resolve "The default website isn't defined"

ReadyMage requires having store views, stores, and website defined in the config.php file

The folder structure on the Magento server

Magento files are stored in /var/www/shared/public and can be checked through SSH access.

Applying patches

Magento patches must be placed in src/patches

There should be no composer.patches.json file. The indication of patches should be via "extra: patches" in composer.json.

Last updated