1
0
Fork 0
Commit graph

20 commits

Author SHA1 Message Date
Jaroslav Škarvada
16d4acbaca
Project renamed to TuneD
The 'D' is now capital to clarify pronunciation.

DBus service name is kept as '/Tuned' not to break
backward compatibility.

This will also need update of downstream tests
which rely on the specific output strings containing
the name.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2021-05-17 22:09:02 +02:00
Jaroslav Škarvada
98c3707851
log: initialize maxBytes, backupCount in RotatingFileHandler explicitly with int
Fixes: #148

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2019-01-12 10:07:07 +01:00
Matthias Gerstner
444aceefa5
logs: actually use SystemRandom source for generating a random string
The returned string was only pseudo random. It is only used for the
log_capture_start() mechanism at the moment. Therefore an attacker might
be able to guess the tokens of other users. Since this data it publicly
available anyways it should not be a big issue, however.
2018-12-11 11:06:01 +01:00
Lidong Zhong
4791290f9b log: add two options(log_file_count and log_file_maxbytes) in the main config file
Currently the logrotation is not configurable. On system with large
amount of cpus a tuned start creates a lot of entries and older log
entries are lost.
2018-09-11 15:42:53 +08:00
Ondřej Lysoněk
829c7de36c Support sending logs over DBus
Add two DBus calls:
log_capture_start(log_level, timeout)
 * This will instruct Tuned to create a new log handler, which will
   start writing log messages with level 'log_level' and higher to
   a buffer. The log levels are standard Python log levels (e.g.
   logging.INFO) or Tuned's custom log level LOG_LEVEL_CONSOLE which
   is defined as 60. The handler will be destroyed after 'timeout' seconds
   if contents of the buffer are not collected using log_capture_finish()
   before the timeout. If 'timeout' <= 0, log messages will be collected
   for as long as it takes before log_capture_finish() is called (use
   with care, so that you don't fill up memory with Tuned logs). This
   call returns a string ID of the log handler, a token, which should
   be passed to log_capture_finish().

log_capture_finish(token)
 * This will return (as a string) log messages collected by a log handler
   associated with the 'token'. It will also destroy the log handler.

These calls are privileged. They can only be called by the root user or
by a user logged in on a local console (just like the change-profile DBus
calls). This restriction is meant to prevent ordinary users from forcing
Tuned to allocate an insane amount of memory for the log buffers and crash
it (or other processes). In the future we may wish to replace this
restriction with a configurable policy which determines how many (and how
big) log buffers can a user with a given UID create. We may also want to
destroy the log handler when the original caller disconnects from DBus.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-11 09:23:20 +02:00
Ondřej Lysoněk
bd91f06d17 log: Introduce log level CONSOLE
This level has the highest severity. It is meant for important messages
about situations which may require user intervention. These messages
will be shown to the user on the console when running tuned-adm (this is
implemented in a followup commit).

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2018-06-11 08:13:23 +02:00
Ondřej Lysoněk
e3ed58e160 Fix calling methods of parent classes
This fixes Pylint errors such as the following:
tuned/logs.py:39: [E1003(bad-super-call), TunedLogger.__init__] \
Bad first argument 'self.__class__' given to super()

This prevents infinite recursion errors, see
https://stackoverflow.com/a/18208725

This does introduce name duplication, but when we drop python2 support
in the future, we can use super() without arguments.
2018-01-14 15:13:27 +01:00
Ondřej Lysoněk
09dfe23805 Drop TunedLogger.set_level()
Drop TunedLogger.set_level(). It doesn't appear to be used anywhere
and it causes problems with Python3, because logging._levelNames
doesn't exist anymore.
2018-01-14 15:13:19 +01:00
Ondřej Lysoněk
90395d1a15 logs: Fix syntax error
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2017-07-04 10:57:33 +02:00
Jaroslav Škarvada
1c2ce2b607
logger: correctly remove all logging handlers
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2017-06-23 18:30:23 +02:00
Ondřej Lysoněk
abb5a104d9 Fix logging to file in the current directory
Previously if you ran 'tuned -l log', it would crash with:
OSError: [Errno 2] No such file or directory: ''
This patch fixes the bug.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2017-02-16 09:38:42 +01:00
Jaroslav Škarvada
9c1f10945e tuned: new option --pid, -P to write PID file
If used without argument as --pid or -P the tuned will write the PID file even
if running in foreground. The PID file is always written if running as daemon.

If used with argument as --pid FILE or -P FILE, the PID will be written to
FILE. This is also applicable for daemon.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2013-02-18 14:31:06 +01:00
Jaroslav Škarvada
7a4d1f2399 tuned: new option --log, -l to select log file
If used without argument as --log or -l the tuned will log to file even if
running on foreground. It will not log to console. This is the default if
running as daemon.

If used with argument as --log FILE, -l FILE, the log will be stored to FILE.
This is also applicable for deamon.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2013-02-18 11:09:57 +01:00
Jan Vcelak
a49f53e60f GPL headers only into executables and main module
GPL license does not require all files to have the copyright notice
and header. To save some space, I removed the headers from all files
except the executables and the main Python module.
2012-11-09 12:27:20 +01:00
Jan Vcelak
1bc60f0b9b tuned: fix logging to files 2012-03-22 10:49:24 +01:00
Jan Kaluza
25371679a4 Profiles and scripts can be loaded from /etc/tuned or /usr/lib/tuned without need to define absolute paths 2012-03-13 11:12:08 +01:00
Jan Kaluza
762c30b97a Cleanup plugins when changing profile 2012-03-12 13:45:56 +01:00
Jan Kaluza
9c3c001f70 Do not propagate log message to not print them for the second time in root_logger 2012-01-27 10:16:31 +01:00
Jan Vcelak
a52b2e7b16 logging: set correct level for child loggers 2011-12-15 16:59:33 +01:00
Jan Vcelak
80d7fe7c1d rename /src to /tuned 2011-11-16 14:34:13 +01:00
Renamed from src/logs.py (Browse further)