def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("/rm"),
                    event.deep_get("Image", default="").endswith("/rmdir"),
                    event.deep_get("Image", default="").endswith("/shred"),
                    event.deep_get("Image", default="").endswith("/unlink"),
                ]
            ),
            any(
                [
                    "/var/log" in event.deep_get("CommandLine", default=""),
                    "/var/spool/mail" in event.deep_get("CommandLine", default=""),
                ]
            ),
            not any(
                [
                    all(
                        [
                            event.deep_get("Image", default="").endswith("/rm"),
                            event.deep_get("CommandLine", default="").startswith(
                                "rm -f /var/log/sysstat/"
                            ),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("Image", default="").endswith("/rm"),
                            event.deep_get("CommandLine", default="").startswith(
                                "rm -f -- /var/log//dmesg"
                            ),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
