1
0
mirror of https://github.com/azlux/log2ram synced 2024-11-23 13:56:30 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Rasmus Bondesson
f570ff6e4b
README: Small fixed and addition of troubleshooting tips (#160)
- Move "Is it working?" section to after "Install"
- Adjust "Is it working?" a bit, mention "systemctl status"
- Wording
- Add Troubleshooting section with journal cleanup tips
2021-06-23 16:17:05 +02:00
e41b7630fc
ansible playbook to install log2ram
Merge pull request #156 from smu/master
2021-06-23 16:15:47 +02:00
Stefan Muthers
a30bf5664e ansible playbook to install log2ram 2021-05-08 20:57:14 +02:00
2 changed files with 93 additions and 21 deletions

View File

@ -10,12 +10,13 @@ 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)
_____ _____
## Menu ## Table of Contents
1. [Install](#install) 1. [Install](#install)
2. [Upgrade](#upgrade) 2. [Is it working?](#is-it-working)
3. [Customize](#customize) 3. [Upgrade](#upgrade)
4. [It is working ?](#it-is-working) 4. [Customize](#customize)
5. [Uninstall](#uninstall-) 5. [Troubleshooting](#troubleshooting)
6. [Uninstall](#uninstall-)
## Install ## Install
### With APT (recommended) ### With APT (recommended)
@ -35,6 +36,31 @@ _____
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)
@ -57,22 +83,7 @@ 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.
### It is working? #### compressor:
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. |
@ -88,6 +99,35 @@ 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

@ -0,0 +1,32 @@
---
- 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