Commit Graph

285 Commits

Author SHA1 Message Date
Zuul 014047bfd0 Merge "Remove implementation for watch_log_file" 2024-04-23 11:16:16 +00:00
Takashi Kajinami b977cb9bec Remove implementation for watch_log_file
... and raise an exception when the feature is explicitly requested.

The feature has been broken for some time, and depends on pyinotify
library which has been unmaintained for long time and is not compatible
with python 3.12 (because it uses asyncore).

Related-Bug: #1740111
Closes-Bug: #2059855
Change-Id: I209b1260ed4de64cbfc561a1da81a66f7a5ea397
2024-04-19 12:36:43 +00:00
Zuul 3a6bb3ce5c Merge "Remove fallback for old oslo.context" 2024-04-18 11:54:47 +00:00
Zuul 138b0caf84 Merge "Apply eventlet workaround only once" 2024-04-15 11:55:51 +00:00
Takashi Kajinami 142fde8224 Apply eventlet workaround only once
... to avoid issues caused by setup method called multiple times.

Closes-Bug: #1995514
Change-Id: I125f7a8fa12f4d17af70987c20e5dedb14232d7b
2024-04-15 08:28:23 +00:00
Zuul d59dfca5f1 Merge "Fix broken reference to rate_limit_except_level" 2024-04-09 12:05:33 +00:00
Zuul 1e68ceb2c5 Merge "Validate rate_limit_except_level by choices" 2024-04-09 12:05:32 +00:00
Takashi Kajinami 31603ac6da Deprecate watch_log_file
This feature has been broken for some time without any actual update
to fix it. Also the pyinotify package used hasn't been updated for 9
years and looks badly unmaintained.

Related-Bug: #1740111
Related-Bug: #2059855
Change-Id: If776fee0072d95737e1c19ad673a3c881a89de06
2024-03-31 05:10:58 +00:00
Takashi Kajinami 65e33466ae Remove fallback for old oslo.context
The get_logging_values method was added in oslo.context 2.0.0[1].

[1] 22ad2c2c591f16012a75c99bd11b2f30d35bffff

Closes-Bug: #1715148
Change-Id: Idb31334674805e821cf5c34b9553b7002d158b6c
2024-03-30 18:26:58 +00:00
Takashi Kajinami 4bd77b6923 Fix broken reference to rate_limit_except_level
Closes-Bug: #1946496
Co-Authored-By: Jonathan Mills <jonmills@gmail.com>
Change-Id: If7439d111c66d00a2e4cb7425f48d3d501e5a124
2024-03-31 00:44:41 +09:00
Takashi Kajinami 42639aaac4 Validate rate_limit_except_level by choices
... to reject invalid values with explicit errors.

Change-Id: I04d10bb977c4ebdaed7b5a2d159ae9c10897679b
2024-03-31 00:43:10 +09:00
Vasyl Saienko a1fe1b9cfb Fix eventlet detection
Eventlet may be installed, but not used for example projects
like octavia. Improve autodetection mechanism by trying to import
module and check if it is actually patched.

Closes-Bug: #2039346
Change-Id: I860abe953ce945bb5152c77a7daeb6aa1003512b
2024-03-26 14:50:12 +00:00
Zuul b5b8c30b0d Merge "Deprecate Windows support" 2023-09-08 11:27:29 +00:00
Takashi Kajinami f3693db5ee Deprecate Windows support
Unfortunately the Winstackers project has been retired because of no
maintainers[1][2], and OpenStack on Windows host is no longer
maintained.

[1] https://lists.openstack.org/pipermail/openstack-discuss/2022-November/031044.html
[2] https://review.opendev.org/c/openstack/governance/+/886880

Change-Id: I4ad06af023fb4812dc9c6a15a23c5e85ef6cce8d
2023-09-08 08:25:38 +09:00
Alfredo Moralejo 390a1d108e Catch RuntimeError when loading log config file
Since python 3.12, logging is raising RuntimeError when content is
invalid [1][2]. Note this is also backported to 3.11 branch.

This is making oslo_log to not raise LogConfigError but throw the
underlying RuntimeError.

[1] 152227b569
[2] 12f1581b0c

Change-Id: I7631394bee7281f6a393ab4ba7604f871626997a
2023-08-09 16:03:23 +02:00
Rodolfo Alonso Hernandez de615d9370 Make the eventlet logging fix execution conditional
This patch changes the ``log.setup()`` signature to allow a kwarg
that makes the eventlet logging fix conditional.

Some libraries that import oslo.log, replace the logging locking
handling with its own implementation. For example oslo.privsep
replaces the logging handler with its own one [1], that allows the
communication between the privileged daemon process and the service
importing the library. This local handler clashes with the
evenlet logging fix implemented in [2].

[1]1020c6fbf5/oslo_privsep/daemon.py (L579)
[2]https://review.opendev.org/c/openstack/oslo.log/+/852443

Partial-Bug: #1995514
Related-Bug: #1995091
Change-Id: I4bbcfe7db6d75188e61b9084cb02b2dd2aaa0c76
2022-11-14 16:59:12 +00:00
Gorka Eguileor 94b9dc32ec Fix logging in eventlet native threads
There is a bug in eventlet where logging within a native thread can lead
to a deadlock situation: https://github.com/eventlet/eventlet/issues/432

When encountered with this issue some projects in OpenStack using
oslo.log, eg. Cinder, resolve them by removing any logging withing
native threads.

There is actually a better approach. The Swift team came up with a
solution a long time ago [1], and in this patch that fix is included as
part of the setup method, but will only be run if the eventlet library
has already been loaded.

This patch adds the eventlet library as a testing dependency for the
PipeMutext unit tests.

[1]: 69c715c505

Closes-Bug: #1983863
Change-Id: Iac1b0891ae584ce4b95964e6cdc0ff2483a4e57d
2022-08-08 17:09:50 +02:00
Hervé Beraud 66f9be975c [Fix] init global_request_id if not in context
Initialize by default the `global_request_id` if not passed
in the given context to avoid error with logging.

Change-Id: I6bd63c1d6a1331a4e47b923ccf6df50c930c8162
Closes-Bug: #1972974
2022-05-11 11:19:32 +02:00
Zuul ebdee7f399 Merge "Log Global Request IDs by default" 2022-04-26 12:21:47 +00:00
Takashi Kajinami 2ba348facb Log Global Request IDs by default
Global Request IDs were introduced a while ago[1] so that operators can
trace processing of resources across multiple services more easily.

Some services like Nova or Neutron have implemented this feature and
a request made by these services have additional global request id in
its context. However current default format doesn't include that new id
and users need to update the log format parameter in each service to
get this information recorded.

This change updates the default log format so that the Global Request
IDs can be more widely and easily used.

[1] https://specs.openstack.org/openstack/oslo-specs/specs/pike/global-req-id.html

Change-Id: I1adc9b29bb356ce56704c066b375b49374200d3c
2022-04-25 13:02:15 +00:00
Takashi Kajinami 7ed065f38d Add system scope information to default user identity string
As part of Secure RBAC work, support for system users(eg. system admin)
is being added. However current default format does not include
the system scope information so we can't determine whether the context
is non-scoped or system-scoped.

This change updates the default logging_user_identity_format so that
system scope is logged by default.

Change-Id: I7982cdb280599fb38362eb837cb527592267b91f
2022-04-19 17:08:58 +09:00
Goutham Pacha Ravi 29b6146cbe Add Zed in versionutils
with these once could use versionutils.deprecated.ZED
in config annotations and logs.

Change-Id: I8d5ed01a4b4d1a544fe868c571a54dc96e8ae2f2
2022-03-11 03:15:09 +05:30
Alan Bishop de03a59ed7 Add Yoga to versionutils
Change-Id: If1e846c79477cb0fc06d5702240e1dbb9f2c9c40
2022-02-05 13:00:13 -08:00
Alan Bishop 650ce7d313 Use project when logging the user identity
The logging_user_identity_format option's default value is changed
to reference the project instead of the tenant. This is necessary
because I2fded6f3476df1fb8c4e042ef28ed8ccb7ab0737 removed the tenant
argument from request contexts.

Related-Bug: #1505827
Change-Id: Id6d4b6eaa2b96ba5bd53e8b2dae5d9eea13b25d9
2022-02-05 12:58:43 -08:00
Takashi Kajinami 96a08b8ff9 Replace deprecated arguments of RequestContext
The following arguments of the RequestContext class are deprecated
since oslo.context 2.18[1].
 user          : renamed to user_id
 tenant        : renamed to project_id
 domain        : renamed to domain_id
 user_domain   : renamed to user_domain_id
 project_domain: renamed to project_domain_id

This change updates arguments used accordingly.

[1] d78cf592e1e3e7aa0fc99bfdd655e82f5c44dfe3

Change-Id: I815790106e42ca3cb5b8b3cf98b065a27b9a520e
2021-07-23 00:24:39 +09:00
Zuul 41c8807534 Merge "Remove references to 'sys.version_info'" 2021-06-01 12:21:07 +00:00
dengzhaosen 526192ddba Ussuri+ is python3 only
update python to python3

Change-Id: I08e9b66e03c59af7f6600633aaa87d55fcd46a56
2021-05-06 09:25:46 +08:00
Jorhson Deng 26d1c29938 Remove references to 'sys.version_info'
We support Python 3.6 as a minimum now, making these checks no-ops.

Change-Id: Ifd84fe4d7282e93998dc37cab4adda6d99d4adc1
2021-04-27 01:37:10 +00:00
Zuul b8ccdcf9e9 Merge "Fix log_rotate_interval help text formatting" 2021-04-16 12:04:08 +00:00
Zuul 2c067a916c Merge "remove unicode from code" 2021-04-16 11:45:36 +00:00
Eric Harney e9dc1f7b32 Fix log_rotate_interval help text formatting
Add a missing space, this currently generates
"setto" in config files.

Change-Id: I4086fcab1e96e9127d7fe084d887cf57c8f87828
2021-04-15 08:41:41 -04:00
Ben Nemec 9da8c33a64 Add Xena to versionutils
Adding warrior princess release to the list of releases. :-)

Change-Id: I6bf6997899f6c95ed1074563164b82fce37f26f3
2021-01-19 18:14:07 +00:00
xuanyandong 333e9ee27e remove unicode from code
Change-Id: I4e4e6fc55053e9d524620022af442f1313a97446
2021-01-03 16:09:31 +08:00
Jan Vondra 6f9b434bb3 Added uwsgi_name information into fluentFormatter event message
When running under uwsgi a new key "uwsgi_name" is added to log
events when using FluentFormatter that could be used for further
analysis. It's value is taken from uwsgi configuration upon
formatter initialization.

Change-Id: I158409677523978246c26bf1168f323974d817a5
Closes-Bug: 1887232
2020-07-11 16:01:32 +00:00
Goutham Pacha Ravi 880bcb89fd Add Victoria and Wallaby in versionutils.deprecated
with these once could use versionutils.deprecated.VICTORIA
and versionutils.deprecated.WALLABY in config annotations
and logs.

Change-Id: I784dfe70c451958bf686f7d0e5ea9f5540bae08c
2020-06-18 16:30:17 -07:00
Zuul 65d5ec3c71 Merge "Stop to use the __future__ module." 2020-06-03 10:26:43 +00:00
Hervé Beraud 0c78733777 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I2f3e6a91ec94f14d7a5cd65b1a32d55eb788c216
2020-06-02 20:39:26 +02:00
Brian Haley 184235c265 Default facility to None in OSJournalHandler class
Use a default value of None for facility in OSJournalHandler
class, as is done in the OSSysLogHandler class.

Neutron started failing with a:

 E1120: No value for argument 'facility' in constructor call

With a recent release of oslo.log.

Change-Id: I5269b82d219fd2377535120d9d266238d50431b3
Related-Bug: #1871840
2020-06-01 17:58:33 -04:00
Benjamin Reichel 5b12e66f62 Add missing SYSLOG_FACILITY to JournalHandler
Without SYSLOG_FACILITY log messages from journald forwards the message
to kern.log. This seems to be default behaviour as it treats the message
as kernel message.

This option provides a proper facility to the log message and kern.log
will not be filled up anymore.

Change-Id: I62a32ed46a400b62ead8c1e6e64acee658e2a769
Closes-Bug: #1871840
2020-05-07 14:46:08 +02:00
Sean McGinnis 105eadbbac
Remove monotonic usage
The monotonic package was needed for monotonic time operations when
running under Python runtimes older than 3.3. Since we now only support
versions higher than this, this third party package requirement can now
be removed.

Change-Id: Id250b92d11aeb6fa02e264610bfe8e8c71df7e26
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-05-04 17:26:30 -05:00
OpenStack Proposal Bot 50e5983f10 Imported Translations from Zanata
For more information about this automatic import see:
https://docs.openstack.org/i18n/latest/reviewing-translation-import.html

Change-Id: I6dbd3aaf4049b1dc2e3b6f58d64638525adad2fe
2020-04-16 06:14:33 +00:00
Sean McGinnis 2aaf7b08a6
Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I5587ac8f603798aad27908d3bd6ed8ebb3a9c14e
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-03-31 14:41:14 -05:00
Zuul 2a47215e36 Merge "drop use of six" 2020-03-21 21:56:08 +00:00
Hervé Beraud 55ef517065 drop use of six
Change-Id: I0ad972f48ee6bc331b96aa67bd7e69c97fa8e2c3
2020-03-12 09:28:33 +01:00
Zuul d03794b524 Merge "Switch to hacking 2.x" 2020-03-09 17:10:33 +00:00
Ben Nemec adef9b6ecb Add Victoria and Wallaby releases to versionutils
Now that we have names for the next two releases we can get them
added here so we'll be ready when development starts.

Change-Id: I515a6b03b810a7c8b2246279e380973a29c626f4
2020-03-05 22:11:51 +00:00
Cyril Roelandt 0a66500081 Switch to hacking 2.x
Change-Id: I2c34c98ba6c927a0b1048e998ff50e063e94b481
2020-02-07 15:53:21 +01:00
Sean McGinnis 80a6e26650
Drop use of unittest2
unittest2 was needed for Python version <= 2.6, so it has not been
needed for quite some time now. See unittest2 note on:

https://docs.python.org/2.7/library/unittest.html

This replaces unittest2 in favor of the standard unittest package.

Change-Id: Idd5df4c8068810bbbd2bd5058ca38df9f5416a62
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-01-12 02:36:28 -06:00
Stephen Finucane f8283aa222 Always use jsonutils.to_primitive 'fallback' parameter
This was optionally being enabled to handle the case where we did not
have oslo.serialization 2.21.1. Our minimum version is now 2.25.0 so
this will never be the case. Remove this optionality logic.

Change-Id: Ib61e1fd02a5ec98ddcaed2ce42f049636598870f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-12-10 10:55:17 +00:00
Vladyslav Drok b52c8cd247 Serialize complex objects in FluentFormatter
This change introduces the serialization with basically json dumps,
falling back to repr for non-serializable object. We check the types
of the top level objects passed to the formatter, as for example
an object enclosed into dictionary passed to the logger should be a
much more rare case.

Closes-Bug: 1782361
Change-Id: Ib214f95abfadd91f85b6cce853057a572ec287f6
2019-12-09 15:18:45 +00:00