saf.collect package#
Submodules#
saf.collect.beacons module#
The beacons collect plugin exists as an implementation example.
It listens to Salt’s event bus for beacon events and generates analytics events based off of those.
- pydantic model saf.collect.beacons.BeaconsConfig[source]#
Bases:
CollectConfigBase
Configuration schema for the beacons collect plugin.
Show JSON schema
{ "title": "BeaconsConfig", "description": "Configuration schema for the beacons collect plugin.", "type": "object", "properties": { "plugin": { "title": "Plugin", "type": "string" }, "beacons": { "title": "Beacons", "type": "array", "items": { "type": "string" } } }, "required": [ "plugin", "beacons" ] }
- Config:
allow_mutation: bool = False
underscore_attrs_are_private: bool = True
- Fields:
- pydantic model saf.collect.beacons.BeaconCollectedEvent[source]#
Bases:
CollectedEvent
Beacons collected event.
Show JSON schema
{ "title": "BeaconCollectedEvent", "description": "Beacons collected event.", "type": "object", "properties": { "data": { "title": "Data", "type": "object" }, "timestamp": { "title": "Timestamp", "type": "string", "format": "date-time" }, "beacon": { "title": "Beacon", "type": "string" }, "tag": { "title": "Tag", "type": "string" }, "stamp": { "title": "Stamp", "type": "string", "format": "date-time" }, "raw_data": { "title": "Raw Data", "type": "object" } }, "required": [ "data", "beacon", "tag", "stamp", "raw_data" ] }
- Fields:
- Validators:
_validate_stamp
»stamp
- field stamp: datetime [Required]#
- Validated by:
_validate_stamp
- saf.collect.beacons.get_config_schema() Type[BeaconsConfig] [source]#
Get the beacons plugin configuration schema.
- async saf.collect.beacons.collect(*, ctx: PipelineRunContext[BeaconsConfig]) AsyncIterator[BeaconCollectedEvent] [source]#
Method called to collect events.
saf.collect.file module#
A file collector plugin.
- class saf.collect.file.CollectedLineData(**kwargs)[source]#
Bases:
TypedDict
Collected event line data definition.
- pydantic model saf.collect.file.CollectedLineEvent[source]#
Bases:
CollectedEvent
Collected line event definition.
Show JSON schema
{ "title": "CollectedLineEvent", "description": "Collected line event definition.", "type": "object", "properties": { "data": { "$ref": "#/definitions/CollectedLineData" }, "timestamp": { "title": "Timestamp", "type": "string", "format": "date-time" }, "backfill": { "title": "Backfill", "default": false, "type": "boolean" } }, "required": [ "data" ], "definitions": { "CollectedLineData": { "title": "CollectedLineData", "type": "object", "properties": { "line": { "title": "Line", "type": "string" }, "source": { "title": "Source", "type": "string", "format": "path" } }, "required": [ "line", "source" ] } } }
- field data: CollectedLineData [Required]#
- pydantic model saf.collect.file.FileCollectConfig[source]#
Bases:
CollectConfigBase
Configuration schema for the file collect plugin.
Show JSON schema
{ "title": "FileCollectConfig", "description": "Configuration schema for the file collect plugin.", "type": "object", "properties": { "plugin": { "title": "Plugin", "type": "string" }, "paths": { "title": "Paths", "type": "array", "items": { "type": "string", "format": "path" } }, "backfill": { "title": "Backfill", "default": false, "type": "boolean" } }, "required": [ "plugin", "paths" ] }
- Config:
allow_mutation: bool = False
underscore_attrs_are_private: bool = True
- Fields:
- field paths: List[pathlib.Path] [Required]#
- saf.collect.file.get_config_schema() Type[FileCollectConfig] [source]#
Get the file collect plugin configuration schema.
- async saf.collect.file.collect(*, ctx: PipelineRunContext[FileCollectConfig]) AsyncIterator[CollectedLineEvent] [source]#
Method called to collect file contents.
saf.collect.test module#
Test collect plugin.
The test collect plugin exists as an implementation example and also to be able to test the salt-analytics-framework
- pydantic model saf.collect.test.TestCollectConfig[source]#
Bases:
CollectConfigBase
Test collector configuration.
Show JSON schema
{ "title": "TestCollectConfig", "description": "Test collector configuration.", "type": "object", "properties": { "plugin": { "title": "Plugin", "type": "string" }, "interval": { "title": "Interval", "default": 0.1, "exclusiveMinimum": 0, "type": "number" }, "count": { "title": "Count", "default": 9223372036854775807, "exclusiveMinimum": 0, "exclusiveMaximum": 9223372036854775807, "type": "integer" } }, "required": [ "plugin" ] }
- Config:
allow_mutation: bool = False
underscore_attrs_are_private: bool = True
- Fields:
- saf.collect.test.get_config_schema() Type[TestCollectConfig] [source]#
Get the test collect plugin configuration schema.
- async saf.collect.test.collect(*, ctx: PipelineRunContext[TestCollectConfig]) AsyncIterator[CollectedEvent] [source]#
Method called to collect events, in this case, generate.
saf.collect.salt_exec module#
A collect plugin that simply collects the output of a salt execution module.
- pydantic model saf.collect.salt_exec.SaltExecConfig[source]#
Bases:
CollectConfigBase
Configuration schema for the salt_exec collect plugin.
Show JSON schema
{ "title": "SaltExecConfig", "description": "Configuration schema for the salt_exec collect plugin.", "type": "object", "properties": { "plugin": { "title": "Plugin", "type": "string" }, "interval": { "title": "Interval", "default": 5, "type": "number" }, "fn": { "title": "Fn", "default": "test.ping", "type": "string" }, "args": { "title": "Args", "default": [], "type": "array", "items": {} }, "kwargs": { "title": "Kwargs", "default": {}, "type": "object" } }, "required": [ "plugin" ] }
- Config:
allow_mutation: bool = False
underscore_attrs_are_private: bool = True
- Fields:
- field args: List[Any] = []#
- saf.collect.salt_exec.get_config_schema() Type[SaltExecConfig] [source]#
Get the salt_exec plugin configuration schema.
- async saf.collect.salt_exec.collect(*, ctx: PipelineRunContext[SaltExecConfig]) AsyncIterator[CollectedEvent] [source]#
Method called to collect events.