Skip to content

[FEATURE REQUEST] - Engine "tag" parameter does not accept wildcards #67130

@z900collector

Description

@z900collector

When processing Beacon data using an "Engine" the "tag" in the call event = event_bus.get_event(tag="salt/beacon/") does not appear to allow wildcards, therefore you cannot specify the actual beacon type you wish to capture and process.

Describe the solution you'd like
Allow the tag parameter to accept wildcards so that the relevant events can be filter before the call exits.
Example:
event = event_bus.get_event(tag="salt/beacon/*/btmp")
event = event_bus.get_event(tag="salt/beacon/*/load/")

Describe alternatives you've considered
A workaround is to just attempt to access the expected fields and skip processing if they are not present.

Additional context

Example Load Beacon processing as currently implemented:

def start():
with event_bus_context(opts) as event_bus:
while True:
event = event_bus.get_event(wait=10,tag="salt/beacon/")
if event:
id = event.get("id", "")
m1 = event.get("1m", "")
if m1 != "":
m5 = event.get("5m","")
m15 = event.get("15m","")
write_load_data(id,m1,m5,m15)

Example diskusage beacon as currently implemented:

def start():
with event_bus_context(opts) as event_bus:
while True:
event = event_bus.get_event(wait=10,tag="salt/beacon/")
if event:
id = event.get("id", "")
diskusage = event.get("diskusage", "")
if diskusage != "":
mount = event.get("mount","")
write_diskusage_data(id,mount,diskusage)

Changes would not break existing code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Featurenew functionality including changes to functionality and code refactors, etc.needs-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions