0

So I have an app that is refusing node.js connections. Our AWS EC2 install is out of memory. Found out it was a log file ("redis_6534.log") that is 5.1G. I need to see what is in the log file (prefer to push to S3 or save to local mac). Then I want to delete or remove the log file ("redis_6534.log") from my kue node.js server.

I tried to export the log file to S3 (using s3cmd put my.file s3://pactsRamun/folderExample/fileExample), but my Ubuntu server says I don't have "s3cmd" installed. Tried to install, but says admin needs to install it.

So...

  1. I need to find out what is in the log file.
  2. Download or push the log file to some safe place.
  3. Need to delete or remove the contents of the log file.
  4. If I deleted the log file then I need to replace it with a new log file.

I need to start with step 1. and 2. first. Any help would be appreciated. I am developer not a server jockey so this all new to me.

UPDATE ====

So I did head and tail on the first and last 300 lines. Its just logs saying server started and restarted.

So I now need to empty that file. If I try to vim it on the server I am guessing it will crash the server trying to edit that large of a file? Wondering the best way to remove and replace the log file?

A: Do I stop the server, delete the file and reboot. Assume the server will create a new log file?

OR

B: Can I rename the file and create a new file with the same name? (But do I need to stop the server first?

1 Answer 1

1

Deleting that log file and rebooting the server should be fine. Log files are almost always created by the software that writes to it.

You can do the following to empty that log file, after logging in at your server :

sudo bash
cd /var/log/redis
> redis_6534.log
exit

Assuming that the file is located in /var/log/redis/ The ">" sign will empty files. Be careful with using that, as well as being careful about using sudo like this.

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.