Feature #213

Feature #357: Enduro/X 7.0 master task

Feature #286: async logger and latent command framwork (LCF)

Out of the box logrotate feature

Added by Madars over 5 years ago. Updated about 2 years ago.

Status:ClosedStart date:09/10/2017
Priority:High (Code 3)Due date:
Assignee:-% Done:


Target version:-


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


#1 Updated by Madars over 5 years 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 over 5 years ago

  • Priority changed from Normal (Code 4) to High (Code 3)

#3 Updated by Madars over 5 years 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 over 5 years ago

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

#5 Updated by Madars over 5 years ago

See pthread_rwlock* functions.

#6 Updated by Madars over 5 years ago

planned in v 6.x

#7 Updated by Madars over 5 years 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)

#8 Updated by Madars over 5 years 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

#9 Updated by Madars over 2 years ago

  • Status changed from New to Resolved

#10 Updated by Madars over 2 years ago

  • Parent task set to #286

Release notes

Implemented logrotate via: xadmin lcf logrotate command.

See xadmin(8) manpage for more details.

#11 Updated by Madars over 2 years ago

  • % Done changed from 0 to 100

#12 Updated by Madars about 2 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF