def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("/iptables"),
                    event.deep_get("Image", default="").endswith("/xtables-legacy-multi"),
                    event.deep_get("Image", default="").endswith("/iptables-legacy-multi"),
                    event.deep_get("Image", default="").endswith("/ip6tables"),
                    event.deep_get("Image", default="").endswith("/ip6tables-legacy-multi"),
                ]
            ),
            any(
                [
                    "-F" in event.deep_get("CommandLine", default=""),
                    "-Z" in event.deep_get("CommandLine", default=""),
                    "-X" in event.deep_get("CommandLine", default=""),
                ]
            ),
            any(
                [
                    "ufw-logging-deny" in event.deep_get("CommandLine", default=""),
                    "ufw-logging-allow" in event.deep_get("CommandLine", default=""),
                    "ufw6-logging-deny" in event.deep_get("CommandLine", default=""),
                    "ufw6-logging-allow" in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
