mongoose.forward.file
- class mongoose.forward.file.FileFormatter[source]
Bases:
BaseFormatterFormats network data for file storage.
This class handles the conversion of network models (DPI, Alert, Flow) into JSON-serializable strings. It ensures that complex types like datetime objects are correctly converted to strings and that any Pydantic-specific fields are handled according to the Pydantic version in use.
- class mongoose.forward.file.FileForwarder(config)[source]
Bases:
BaseForwarderForwards network events to files asynchronously.
Subscribes to specified topics and appends data to a file for each topic. Files are stored in the configured output directory. It manages its own background worker thread for non-blocking operation.
- Security considerations:
Permissions: Ensure the output directory has appropriate permissions to prevent unauthorized access to the dumped network data.
Disk space: Monitor disk space as files will grow indefinitely since this forwarder appends data without rotation or cleanup.
Sensitive data: Network event data may contain sensitive infrastructure information (IPs, ports, protocol details). Ensure the storage medium is secured.
- __init__(config)[source]
Initialize the FileForwarder.
- Parameters:
config (FileForwarderConfiguration) – A FileForwarderConfiguration instance.