1
0
mirror of https://github.com/azlux/log2ram synced 2024-11-23 22:06:10 +00:00

Compare commits

..

No commits in common. "f570ff6e4bde5b019fd601853e503679e042868b" and "82554106c941757bcac6b48185b8958e03fe7fc6" have entirely different histories.

2 changed files with 21 additions and 93 deletions

View File

@ -10,13 +10,12 @@ The script [log2ram](https://github.com/azlux/log2ram) can work on every linux s
Log2Ram is based on transient log for Systemd here : [A transient /var/log](https://www.debian-administration.org/article/661/A_transient_/var/log) Log2Ram is based on transient log for Systemd here : [A transient /var/log](https://www.debian-administration.org/article/661/A_transient_/var/log)
_____ _____
## Table of Contents ## Menu
1. [Install](#install) 1. [Install](#install)
2. [Is it working?](#is-it-working) 2. [Upgrade](#upgrade)
3. [Upgrade](#upgrade) 3. [Customize](#customize)
4. [Customize](#customize) 4. [It is working ?](#it-is-working)
5. [Troubleshooting](#troubleshooting) 5. [Uninstall](#uninstall-)
6. [Uninstall](#uninstall-)
## Install ## Install
### With APT (recommended) ### With APT (recommended)
@ -36,31 +35,6 @@ _____
For better performances. `RSYNC` is a recommended package. For better performances. `RSYNC` is a recommended package.
**REBOOT** before installing anything else (for example apache2) **REBOOT** before installing anything else (for example apache2)
## Is it working?
After installing and rebooting, use systemctl to check if Log2Ram started successfully:
```
systemctl status log2ram
```
This will show a color-coded status (green active/red failed) as well as the last few log lines. To show the full log (scrolled to the end), run:
```
journalctl -u log2ram -e
```
The log is also written to `/var/log/log2ram.log`.
You can also inspect the mount folder in ram with (You will see lines with log2ram if working)
```
# df -h | grep log2ram
log2ram 40M 532K 40M 2% /var/log
# mount | grep log2ram
log2ram on /var/log type tmpfs (rw,nosuid,nodev,noexec,relatime,size=40960k,mode=755)
```
## Upgrade ## Upgrade
You need to stop log2ram (`service log2ram stop`) and start the [install](#install). (APT will do it automatically) You need to stop log2ram (`service log2ram stop`) and start the [install](#install). (APT will do it automatically)
@ -83,7 +57,22 @@ OnCalendar=weekly
``` ```
... or even disable it with `systemctl disable log2ram-daily.timer`, if you prefer writing logs only at stop/reboot. ... or even disable it with `systemctl disable log2ram-daily.timer`, if you prefer writing logs only at stop/reboot.
#### compressor: ### It is working?
You can now check the mount folder in ram with (You will see lines with log2ram if working)
```
# df -h
log2ram 40M 532K 40M 2% /var/log
# mount
log2ram on /var/log type tmpfs (rw,nosuid,nodev,noexec,relatime,size=40960k,mode=755)
```
The log for log2ram will be written at: `/var/log/log2ram.log` and available with `sudo journalctl -t log2ram`
Compressor for zram. Usefull for the `COMP_ALG` of ZRAM on the config file. Compressor for zram. Usefull for the `COMP_ALG` of ZRAM on the config file.
| Compressor name | Ratio | Compression | Decompress. | | Compressor name | Ratio | Compression | Decompress. |
@ -99,35 +88,6 @@ Compressor for zram. Usefull for the `COMP_ALG` of ZRAM on the config file.
###### Now, muffins for everyone! ###### Now, muffins for everyone!
## Troubleshooting
### Existing content in `/var/log` too large for RAM
One thing that stops Log2Ram from starting is if `/var/log` is to large before starting Log2Ram the first time. This can happen if logs had been collected for a long time before installing Log2Ram. Find the largest directories in `/var/log` (this commands only shows the 3 largest):
```
sudo du -hs /var/log/* | sort -h | tail -n 3
```
If the `/var/log/journal` is very large, then there are a lot of system logs. Deletion of old "archived" logs can be fixed by adjusting a setting. Edit the `/etc/systemd/journald.conf` file and add the following option:
```
SystemMaxUse=20M
```
This should be set to a value smaller than the size of the RAM volume, for example half. Then apply the new setting:
```
sudo restart systemd-journal
```
This should shrink the size of "archived" logs to be below the limit. Reboot and check that Log2Ram succeds:
```
sudo reboot
systemctl status log2ram
```
## Uninstall :( ## Uninstall :(
(Because sometime we need it) (Because sometime we need it)

View File

@ -1,32 +0,0 @@
---
- hosts: all
become: true
tasks:
- name: Add apt-key for new repository
apt_key:
keyserver: keyserver.ubuntu.com
id: CA548A0A0312D8E6
- name: Add log2ram to sources.list
apt_repository:
repo: deb http://packages.azlux.fr/debian/ buster main
state: present
- name: update pkg database
apt:
upgrade: yes
update_cache: yes
- name: Install log2ram
apt:
pkg:
- log2ram
- name: modify config
lineinfile:
path: /etc/log2ram.conf
regexp: '^SIZE=(.*)$'
line: 'SIZE=80M'
backrefs: yes
- name: Start log2ram service
systemd:
state: started
name: log2ram