Skip to content
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

treehouses log ram [on|off] 40M memory for log files (fixes #807) #1276

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

LordJashin32
Copy link
Member

@LordJashin32 LordJashin32 commented May 16, 2020

treehouses/builder#717

  • - updated to use builder log2ram package instead
root@treehouses:~/cli# ./cli.sh log ram
log2ram is off
root@treehouses:~/cli# df -h | grep log2ram
root@treehouses:~/cli# ./cli.sh log ram on jjjj
Error: Too many arguments.

Usage: cli.sh log [0|1|2|3|4|show|max|ram [on|off]]

Example:
  cli.sh log
      log 0: log is disabled

  cli.sh log 0
      log 0: log disabled

  cli.sh log 1
      log 1: level set to Info

  cli.sh log 2
      log 2: level set to Info and Warning

  cli.sh log 3
      log 3: level set to Info, Warning, and Error

  cli.sh log 4
      log 4: level set to Info, Warning, Error, and Debug

  cli.sh log show
      Shows the default 6 lines of log which is at (/var/log/syslog)
      @treehouses/cli: temperature fahrenheit

  cli.sh log show 5
      Shows 5 lines of log which is at (/var/log/syslog)
      @treehouses/cli: temperature fahrenheit

  cli.sh log max
      log X: level set to max

  cli.sh log ram
      log2ram is off
  force logs to be stored in ram and only writes to disk on shutdown
  https://github.com/azlux/log2ram
  Stores logs in 40M (Megabytes) in mount point in memory

  cli.sh log ram on
      Successfully started log2ram

  cli.sh log ram off
      Successfully stopped log2ram

root@treehouses:~/cli# ./cli.sh log ram on
Successfully started log2ram
root@treehouses:~/cli# df -h | grep log2ram
log2ram          40M  3.8M   37M  10% /var/log
root@treehouses:~/cli# ./cli.sh log ram on
Successfully started log2ram
root@treehouses:~/cli# df -h | grep log2ram
log2ram          40M  3.8M   37M  10% /var/log
root@treehouses:~/cli# ./cli.sh log ram off
Sucessfully stopped log2ram
root@treehouses:~/cli# df -h | grep log2ram

@kjong
Copy link
Member

kjong commented May 16, 2020

Is the only way to enable and disable this to install and uninstall every time?

Copy link
Member

@law-lin law-lin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me.

root@law-lin:~/cli# ./cli.sh log2ram
log2ram is off
root@law-lin:~/cli# ./cli.sh log2ram
log2ram is off
root@law-lin:~/cli# ./cli.sh log2ram on
Successfully enabled log2ram, please reboot
root@law-lin:~/cli# ./cli.sh log2ram on asodksaodsk
Error: Too many arguments.

Usage: cli.sh log2ram [on|off]

force logs to be stored in ram and only writes to disk on shutdown
https://github.com/azlux/log2ram
Stores logs in 40M (Megabytes) in mount point in memory

Example:
  cli.sh log2ram
      log2ram is off

  cli.sh log2ram on
      Successfully enabled log2ram, please reboot

  cli.sh log2ram off
      Successfully disabled log2ram

root@law-lin:~/cli# ./cli.sh log2ram off
Sucessfully disabled log2ram
root@law-lin:~/cli# ./cli.sh log2ram
log2ram is off
root@law-lin:~/cli# ./cli.sh log2ram on
Successfully enabled log2ram, please reboot
root@law-lin:~/cli# ./cli.sh log2ram
log2ram is off
root@law-lin:~/cli# reboot

...

root@law-lin:~/cli# ./cli.sh log2ram
log2ram is on

@LordJashin32
Copy link
Member Author

LordJashin32 commented May 16, 2020

Is the only way to enable and disable this to install and uninstall every time?

Yeah basically. The package doesn't really give much more than what the install does:

root@treehouses:~/test1/cli# log2ram --help
Usage: log2ram {start|stop|write}

write doesn't even give an output message when i run it. And i can't tell if it ran from from df -h

@LordJashin32
Copy link
Member Author

LordJashin32 commented May 18, 2020

moved to log.sh

root@treehouses:~/cli# ./cli.sh log ram
log2ram is on
root@treehouses:~/cli# ./cli.sh log ram on
Successfully enabled log2ram, please reboot
root@treehouses:~/cli# ./cli.sh log ram on dfds
Error: Too many arguments.

Usage: cli.sh log [0|1|2|3|4|show|max|ram [on|off]]

Example:
  cli.sh log
      log 0: log is disabled

  cli.sh log 0
      log 0: log disabled

  cli.sh log 1
      log 1: level set to Info

  cli.sh log 2
      log 2: level set to Info and Warning

  cli.sh log 3
      log 3: level set to Info, Warning, and Error

  cli.sh log 4
      log 4: level set to Info, Warning, Error, and Debug

  cli.sh log show
      Shows the default 6 lines of log which is at (/var/log/syslog)
      @treehouses/cli: temperature fahrenheit

  cli.sh log show 5
      Shows 5 lines of log which is at (/var/log/syslog)
      @treehouses/cli: temperature fahrenheit

  cli.sh log max
      log X: level set to max

  cli.sh log ram
      log2ram is off
  force logs to be stored in ram and only writes to disk on shutdown
  https://github.com/azlux/log2ram
  Stores logs in 40M (Megabytes) in mount point in memory

  cli.sh log ram on
      Successfully enabled log2ram, please reboot

  cli.sh log ram off
      Successfully disabled log2ram

root@treehouses:~/cli# ./cli.sh log ram off
Sucessfully disabled log2ram
root@treehouses:~/cli# ./cli.sh log ram
log2ram is off
root@treehouses:~/cli# ./cli.sh log ram on
Successfully enabled log2ram, please reboot
root@treehouses:~/cli# ./cli.sh log ram
log2ram is off
root@treehouses:~/cli#

@LordJashin32 LordJashin32 changed the title treehouses log2ram 40M memory for log files (fixes #807) treehouses log ram [on|off] 40M memory for log files (fixes #807) May 18, 2020
@dogi
Copy link
Member

dogi commented May 20, 2020

@LordJashin32 nice one, but on second thought this is something for builder ... at least in parts

@dogi dogi added blocked we needs to fix something else first in progress and removed high priority please test & review labels May 20, 2020
@LordJashin32 LordJashin32 added please test & review and removed blocked we needs to fix something else first in progress labels May 20, 2020
@LordJashin32
Copy link
Member Author

updated for builder package instead. Test results are in main post up top @LordJashin32

@dogi dogi added blocked we needs to fix something else first and removed please test & review labels Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked we needs to fix something else first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants