2023 m. rugsėjo 23 d., šeštadienis

2023 m. rugsėjo 5 d., antradienis

Logging Levels

System logger

$ journalctl --unit=service

$ journalctl -fu service # To follow log as with tail -f

 
To limit journal logging:

$ sudo nano /etc/systemd/journald.conf
Uncomment
SystemMaxUse=100M
sudo systemctl restart systemd-journald

$ journalctl --disk-usage # How much space is used


Restart system logging
$ sudo systemctl restart rsyslog # resets /var/log/syslog, deamong.log
$ sudo systemctl restart logrotate

/usr/sbin/logrotate -f /etc/logrotate.d/spaikon # Force run logrotate

Show detailed debug trace
from loguru import logger
@logger.catch # Stack trace

Python logger

When a logger is created, the level is set to NOTSET (which causes all messages to be processed when the logger is the root logger, or delegation to the parent when the logger is a non-root logger).

Note that the root logger is created with level WARNING.

Level

Numeric value

CRITICAL

50

ERROR

40

WARNING

30

INFO

20

DEBUG

10

NOTSET

0

Documentation:

https://docs.python.org/3/howto/logging.html

2023 m. rugsėjo 1 d., penktadienis

InfluxDB

Web interface: http://localhost:8086

Package info:
$ sudo apt list --installed | grep influx
influxdb2/now 2.7.0-1 arm64 [installed,local]

installing influx:
$ sudo dpkg -i influxdb2-2.7.0-arm64.deb

watching influxdn disk-space
$ watch -d "sudo du -h /var/lib/influxdb/ | sort -rh | head -n 10"

Literals

y    year (12 months)
mo    month
w    week (7 days)
d    day
h    hour (60 minutes)
m    minute (60 seconds)
s    second
ms    milliseconds (1 thousandth of a second)
us or µs    microseconds (1 millionth of a second)
ns    nanoseconds (1 billionth of a second)

 

Websites:

About tasks:
https://docs.influxdata.com/influxdb/v2.7/process-data/get-started/

Python API:
https://docs.influxdata.com/influxdb/cloud/api-guide/client-libraries/python/

Down-sampling:
https://www.influxdata.com/blog/downsampling-influxdb-v2-0/

Examples:
https://github.com/influxdata/influxdb-client-python/tree/1ec64b7e1039c891ac3a667ee6697731c61ddbaf/examples