Skip to content

Logger - running out of disk space. #3403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
omairvaiyani opened this issue Jan 19, 2017 · 6 comments
Closed

Logger - running out of disk space. #3403

omairvaiyani opened this issue Jan 19, 2017 · 6 comments

Comments

@omairvaiyani
Copy link
Contributor

I kept running out of space on my AWS EC2 instance until I figured out that our code deployer was setting VERBOSE to 1. This kept crashing our server almost daily with ENOSPC, until it was redeployed. Now that I've disabled verbose, and set logLevel to "error", I still think that we'll hit ENOSPC eventually. Is there a way to remove older logs?

To be honest, I want to completely disabled logging until I'm sure about this issue no longer being a problem. But I haven't figured out a simple way yet.

@omairvaiyani omairvaiyani changed the title Logger - restrict to 1 week? Logger - running out of disk space. Jan 19, 2017
@codegefluester
Copy link
Contributor

With the default logging it seems like you could simply clean-up the ./logs folder yourself with a cronjob on the server. You could either delete log files, compress older ones or a mix of both. I didn't find a documented config for the Winston logger that would take care of it, but maybe someone else can help on that front https://github.com/winstonjs/winston#usage

@dplewis
Copy link
Member

dplewis commented Sep 21, 2017

For those interested I'm also using AWS. I'm deleting my logs files using cronjobs. First I SSH into my parse-server instance and run the following commands.

Run cron on your box
$ crontab -e

Copy and Paste the following line
55 2 * * * sudo /usr/bin/find /var/app/current/logs/ -type f -mtime +2 -delete;

Replace /var/app/current/logs/ with the location of your logs. The command runs at 2:55AM and only keeps the last 3 days of logs.

@milesrichardson
Copy link

Also, if you're running in docker, and logging to stdout as well as log files, you might need to delete the docker log file for the container. Easiest way to clear it is like this:

echo '' | sudo tee  "/var/lib/docker/containers/${CONTAINER_ID}/${CONTAINER_ID}-json.log"

@dplewis
Copy link
Member

dplewis commented Jan 17, 2018

If you are using AWS you can create a config file that will install cornjobs when you create an instance.

.ebextensions/cron.config

files:
  "/etc/cron.d/parse-log-cleanup":
      mode: "000644"
      owner: root
      group: root
      content: |
        55 2 * * * root /usr/bin/find /var/app/current/logs/ -type f -mtime +2 -delete;

commands:
  remove_old_cron:
    command: "rm -f /etc/cron.d/*.bak"

Notice unlike my last comment this uses root instead of sudo

@dplewis dplewis closed this as completed Jan 17, 2018
@RaschidJFR
Copy link
Contributor

Hi guys. I'm having trouble with a file logs/parse.log that's over 14 GB. I'm running Parse Server on a Bitnami deployment on 1&1. Is there any way to make this file split by day? Or perhaps it's a Bitnami-specific file? (I've beein asking in their community but not resolved yet)

@acinader
Copy link
Contributor

acinader commented May 1, 2019

my $.02 would be to configure logrotate to process your parse log files. this is done by adding a file in /etc/logrotate.d. there's tons of articles on how to configure logrotate with examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants