mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
rename uuid field to trigger restart on update
* Since we trigger a restart on update, we can also cache the tower uuid value in the formatter init. So do that.
This commit is contained in:
@@ -315,12 +315,12 @@ register(
|
|||||||
category_slug='logging',
|
category_slug='logging',
|
||||||
)
|
)
|
||||||
register(
|
register(
|
||||||
'LOG_TOWER_UUID',
|
'LOG_AGGREGATOR_TOWER_UUID',
|
||||||
field_class=fields.CharField,
|
field_class=fields.CharField,
|
||||||
allow_blank=True,
|
allow_blank=True,
|
||||||
label=_('Cluster-wide Tower unique identifier.'),
|
label=_('Cluster-wide Tower unique identifier.'),
|
||||||
help_text=_('Useful to uniquely identify Tower instances.'),
|
help_text=_('Useful to uniquely identify Tower instances.'),
|
||||||
category=_('Logging'),
|
category=_('Logging'),
|
||||||
category_slug='logging',
|
category_slug='logging',
|
||||||
default=uuid.uuid4(),
|
default=None,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class LogstashFormatter(LogstashFormatterVersion1):
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
ret = super(LogstashFormatter, self).__init__(**kwargs)
|
ret = super(LogstashFormatter, self).__init__(**kwargs)
|
||||||
self.host_id = settings.CLUSTER_HOST_ID
|
self.host_id = settings.CLUSTER_HOST_ID
|
||||||
|
self.tower_uuid = getattr(settings, "LOG_AGGREGATOR_TOWER_UUID", None)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def reformat_data_for_log(self, raw_data, kind=None):
|
def reformat_data_for_log(self, raw_data, kind=None):
|
||||||
@@ -135,7 +136,6 @@ class LogstashFormatter(LogstashFormatterVersion1):
|
|||||||
'message': record.getMessage(),
|
'message': record.getMessage(),
|
||||||
'host': self.host,
|
'host': self.host,
|
||||||
'type': self.message_type,
|
'type': self.message_type,
|
||||||
'tower_uuid': getattr(settings, 'LOG_TOWER_UUID', None),
|
|
||||||
|
|
||||||
# Extra Fields
|
# Extra Fields
|
||||||
'level': record.levelname,
|
'level': record.levelname,
|
||||||
@@ -143,6 +143,9 @@ class LogstashFormatter(LogstashFormatterVersion1):
|
|||||||
'cluster_host_id': self.host_id
|
'cluster_host_id': self.host_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.tower_uuid:
|
||||||
|
message['tower_uuid'] = self.tower_uuid
|
||||||
|
|
||||||
# Add extra fields
|
# Add extra fields
|
||||||
message.update(self.get_extra_fields(record))
|
message.update(self.get_extra_fields(record))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user