We've recently migrated from Magento 1 to Magento 2 and it seems that there is a large amount of information in our database files.

We'd like to try to mitigate this by clearing the log files but unlike Magento 1, there does not seem to be a built in facility to do this in Magento 2.

Is there a way to clean out the log files in the database in Magento 2 so that we can hopefully free up some space.

Our database is accessible through phpmyadmin if that helps.

  • have you tried exporting it with gzipped compression ? – magefms Mar 12 at 10:59
  • php bin/magento log:clean will clear all log tables – Shoaib Munir Mar 12 at 11:00
  • Thanks. I'm afraid that it came up with the following: [Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "log" namespace. Did you mean one of these? catalog:product:attributes catalog:product catalog:images catalog dev:query-log dev:urn-catalog – CJNotts Mar 12 at 11:02

these are the tables you can clear/exclude from dumping:

  • "email_abandoned_cart"
  • "email_automation"
  • "email_campaign"
  • "email_contact"
  • "persistent_session"
  • "report_compared_product_index"
  • "report_event"
  • "report_viewed_product_aggregated_daily"
  • "report_viewed_product_aggregated_monthly"
  • "report_viewed_product_aggregated_yearly"
  • "report_viewed_product_index"
  • "session"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.