flowbber.plugins.sinks.archive

Archive

This sink writes all collected data to a JSON file.

Important

This class inherits several inclusion and exclusion configuration options for filtering data before using it. See FilterSink Options for more information.

Dependencies:

pip3 install flowbber[archive]

Usage:

[[sinks]]
type = "archive"
id = "..."

    [sinks.config]
    output = "data.json"
    encoding = "utf-8"
    override = true
    create_parents = true
    pretty = false
    compress = false
{
    "sinks": [
        {
            "type": "archive",
            "id": "...",
            "config": {
                "output": "data.json",
                "encoding": "utf-8",
                "override": true,
                "create_parents": true,
                "pretty": false,
                "compress": false
            }
        }
    ]
}

output

Path to JSON file to write the collected data.

  • Default: N/A

  • Optional: False

  • Schema:

    {
        'type': 'string',
        'empty': False,
    }
    
  • Secret: False

encoding

Encoding to use to encode the file.

  • Default: utf-8

  • Optional: True

  • Schema:

    {
        'type': 'string',
        'empty': False,
    }
    
  • Secret: False

override

Override output file if already exists.

  • Default: False

  • Optional: True

  • Schema:

    {
        'type': 'boolean',
    }
    
  • Secret: False

create_parents

Create output file parent directories if don’t exist.

  • Default: False

  • Optional: True

  • Schema:

    {
        'type': 'boolean',
    }
    
  • Secret: False

pretty

Pretty output.

  • Default: False

  • Optional: True

  • Schema:

    {
        'type': 'boolean',
    }
    
  • Secret: False

compress

Compress the JSON output file in a Zip archive.

If using compression, the .zip extension will be automatically appended to the output filename parameter if not present.

The created archive will contain a JSON file named as the output parameter without the .zip extension. For example:

compress parameter output parameter Saved as File inside Zip
True archive.json archive.json.zip archive.json
True archive.json.zip archive.json.zip archive.json

Compression uses Python’s ZipFile module using the ZIP_DEFLATED option, thus requiring the zlib module.

  • Default: False

  • Optional: True

  • Schema:

    {
        'type': 'boolean',
    }
    
  • Secret: False

Classes

  • ArchiveSink: Common sink base class that adds several inclusion and exclusion
class flowbber.plugins.sinks.archive.ArchiveSink(index, type_, id_, optional=False, timeout=None, config=None)

Inheritance

Inheritance diagram of ArchiveSink