Feature #213

Out of the box logrotate feature

Added by Madars Vitolins 7 months ago. Updated 3 months ago.

Status:NewStart date:09/10/2017
Priority:HighDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Enduro/X should provide out of the box possibility to rotate & archive the logs to ensure that long term trouble free running.

History

#1 Updated by Madars Vitolins 7 months ago

we shall use some shared memory block with current "log number".

each logger (even thread) will check that log number is not changed. If changed. then close the file and open again.

Mean while the logrotate would do following:

1. move all files to some pattern naming, like FILE FILE.1
2. change the log number (increment shared memory)
3. wait for some 60 seconds
4. compress the logs if needed, or move to target folder, etc...

The log rotate could some perl script, then shared mem can be chagned by xadmin.

The above will ensure loss-less log changes in Enduro/X platform.

#2 Updated by Madars Vitolins 6 months ago

  • Priority changed from Normal to High

#3 Updated by Madars Vitolins 6 months ago

We might want to lock the all file descriptors at the time of log-rotate and perform the change of Fdes: http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_rwlock_wrlock.html

#4 Updated by Madars Vitolins 6 months ago

or we have to open for each of the logger/each thread own file descriptor

#5 Updated by Madars Vitolins 6 months ago

See pthread_rwlock* functions.

#6 Updated by Madars Vitolins 6 months ago

planned in v 6.x

#7 Updated by Madars Vitolins 3 months ago

- We could implement async logging via background thread (configured in debug with async=y)
- We make a shared memory with configured slots count where we can publish commands, like change log level, etc... And some few paramters
- Another command would be change the logs
- Commands are applied either to PID, process name and all PIDs.
- Commands have timestamp so that async thread could mark the commands executed or skipped if not matched pid.
- We could provide user registerable commands for user (like tpasynccmd(0x155, p_async_func)) where 0x155 is command code
- the xadmin could publish xadmin 0x155 \-a \-b \-c (and we need to make configurable aliases like 0x155 for example "restartcon")
- the c could receive callback like:

int restartcon_cb(short cmd, char *arg1, char *arg2, char *arg3)
{
...
}
<pre>

#8 Updated by Madars Vitolins 3 months ago

The logger could also once file is open, generate some AES encryption key, encrypt under RSA_PUB found on FS, then then print the AES_RSA in log file.
And then all messages to log file are being printed with AES encryption.

For file decryption, utility shall be provided which would take RSA_PRIV key (maybe encrypted under password). This would ask admin for password to decrypt priv key. Then with priv key from the file get the AES key. Then with AES key decrypt the log file contents

Also available in: Atom PDF