I have a server that has recently had some issues and after rebooting it last night, we are back at it again today.

I noticed today however that the disk is completely full. So I used the du command to find out where all my space had gone and turns out, there is a file under /var/www/websitename/localfolder/etc/log and in that log folder there are several hundred .sql files with dates going as far back as 2015.

I am not opposed to deleting them and I've read some things on how to turn off the logs and do that etc but all those documents assume the logs are kept in the mysql folder. I'm wondering if I should be concerned that these are in my website directory and if it would be the same process that is found here for example: https://stackoverflow.com/questions/7381320/in-mysql-how-can-i-delete-flush-clear-all-the-logs-that-are-not-necessary

Sorry again for the noob question but I just recently inherited all this.

As it was suggested, it is possible these are backups, but uder the same directory as the logs folder, there is a sql folder that contains the websitename.sql

The files in the logs folder follow this convention. websitename-2017-01-09T00:50:04.146Z.sql.

  • It could be your web application is doing some backup of database. Usually,.sql file extension refers to file containing SQL statements such DB backup. You can open one and verify.
    – Khaled
    Commented Jan 31, 2017 at 16:47
  • could be, named websitename-2017-01-09T00:50:04.146Z.sql. The only reason I would think not though, is if you go up a level. There is a log folder AND a SQL folder. SQL folder just has websitename.sql
    – Tyler C
    Commented Jan 31, 2017 at 17:01
  • I suggest also have a look at logrotate. this is a pretty easy util that allows for cleaning up (rotating) old log files (incl. compression and keeping x files). linuxcommand.org/man_pages/logrotate8.html
    – Roger
    Commented Jan 31, 2017 at 18:10

1 Answer 1


The most obvious thing you can do is compress the files. If they're uncompressed text SQL, they'll get a whole lot smaller, like %90 compression. If your OS won't let you compress them because the compression tool wants to use the disk, you should be able to compress to a different partition, delete the large original, and then move compressed file back the log directory.

I concur with @Khaled. Is the web site running particular software, like Wordpress or Drupal? That's where I'd look for answers. The documentation for the web app should tell you how to keep the logs from going berserk.

If the files are backups from as far back as 2015, you can probably delete most of them. You could keep some of them if you want to be super careful, like keep one from each month. Unless you have some kind of record keeping requirement, the only time this is going to come up is if something goes terribly wrong with the web page and the users/owner wants it back up fast. The odds that someone desperately needs the exact version from Jan 29th 2016 are very low. (But do review any record keeping requirements!). And this advice assumes these are in fact backups of a web application and not something else.

So, yeah, make sure they're uncompressed text SQL and compress now for breathing room. Then review the web app and get those logs under control.

  • I ended up backing up the partition, deleted everything older than a month, and restarted. So far everything is back up and running and I can always clone back to get the files if I need to. I'm trying to track down the people who made this web app and see if it was a backup.
    – Tyler C
    Commented Jan 31, 2017 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .