{
  "description": "RuleGroup is the Schema for the RuleGroups API\nSee also https://coralogix.com/docs/user-guides/data-transformation/metric-rules/recording-rules/\n\n**Added in v0.4.0**",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "RuleGroupSpec defines the Desired state of RuleGroup",
      "properties": {
        "active": {
          "default": true,
          "description": "Whether the rule-group is active.",
          "type": "boolean"
        },
        "applications": {
          "description": "Rules will execute on logs that match the these applications.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "creator": {
          "description": "Rule-group creator",
          "type": "string"
        },
        "description": {
          "description": "Description of the rule-group.",
          "type": "string"
        },
        "hidden": {
          "default": false,
          "description": "Hides the rule-group.",
          "type": "boolean"
        },
        "name": {
          "description": "Name of the rule-group.",
          "minLength": 0,
          "type": "string"
        },
        "order": {
          "description": "The index of the rule-group between the other rule-groups.",
          "format": "int32",
          "minimum": 1,
          "type": "integer"
        },
        "severities": {
          "description": "Rules will execute on logs that match the these severities.",
          "items": {
            "description": "Severity to match to.",
            "enum": [
              "Debug",
              "Verbose",
              "Info",
              "Warning",
              "Error",
              "Critical"
            ],
            "type": "string"
          },
          "type": "array"
        },
        "subgroups": {
          "description": "Rules within the same subgroup have an OR relationship,\nwhile rules in different subgroups have an AND relationship.\nRefer to https://github.com/coralogix/coralogix-operator/blob/main/config/samples/v1alpha1/rulegroups/mixed_rulegroup.yaml\nfor an example.",
          "items": {
            "description": "Sub group of rules.",
            "properties": {
              "active": {
                "default": true,
                "description": "Determines whether to rule will be active or not.",
                "type": "boolean"
              },
              "id": {
                "description": "The rule id.",
                "type": "string"
              },
              "order": {
                "description": "Determines the index of the rule inside the rule-subgroup.",
                "format": "int32",
                "type": "integer"
              },
              "rules": {
                "description": "List of rules associated with the sub group.",
                "items": {
                  "description": "A rule to change data extraction.",
                  "properties": {
                    "active": {
                      "default": true,
                      "description": "Whether the rule will be activated.",
                      "type": "boolean"
                    },
                    "block": {
                      "description": "Block rules allow for refined filtering of incoming logs with a Regular Expression.",
                      "properties": {
                        "blockingAllMatchingBlocks": {
                          "default": true,
                          "description": "Block Logic. If true or nor set - blocking all matching blocks, if false - blocking all non-matching blocks.",
                          "type": "boolean"
                        },
                        "keepBlockedLogs": {
                          "default": false,
                          "description": "Determines if to view blocked logs in LiveTail and archive to S3.",
                          "type": "boolean"
                        },
                        "regex": {
                          "description": "Regular Expression. More info: https://coralogix.com/blog/regex-101/",
                          "type": "string"
                        },
                        "sourceField": {
                          "description": "The field on which the Regular Expression will operate on.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "regex",
                        "sourceField"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "description": {
                      "description": "Description of the rule.",
                      "type": "string"
                    },
                    "extract": {
                      "description": "Use a named Regular Expression group to extract specific values you need as JSON getKeysStrings without having to parse the entire log.",
                      "properties": {
                        "regex": {
                          "description": "Regular Expression. More info: https://coralogix.com/blog/regex-101/",
                          "type": "string"
                        },
                        "sourceField": {
                          "description": "The field on which the Regular Expression will operate on.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "regex",
                        "sourceField"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "extractTimestamp": {
                      "description": "Replace rules are used to replace logs timestamp with JSON field.",
                      "properties": {
                        "fieldFormatStandard": {
                          "description": "The format standard to parse the timestamp.",
                          "enum": [
                            "Strftime",
                            "JavaSDF",
                            "Golang",
                            "SecondTS",
                            "MilliTS",
                            "MicroTS",
                            "NanoTS"
                          ],
                          "type": "string"
                        },
                        "sourceField": {
                          "description": "The field on which the Regular Expression will operate on.",
                          "type": "string"
                        },
                        "timeFormat": {
                          "description": "A time formatting string that matches the field format standard.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "fieldFormatStandard",
                        "sourceField",
                        "timeFormat"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "jsonExtract": {
                      "description": "Name a JSON field to extract its value directly into a Coralogix metadata field",
                      "properties": {
                        "destinationField": {
                          "description": "The field that will be populated by the results of the Regular Expression operation.",
                          "enum": [
                            "Category",
                            "CLASSNAME",
                            "METHODNAME",
                            "THREADID",
                            "SEVERITY"
                          ],
                          "type": "string"
                        },
                        "jsonKey": {
                          "description": "JSON key to extract its value directly into a Coralogix metadata field.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "destinationField",
                        "jsonKey"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "jsonStringify": {
                      "description": "Convert JSON object to JSON string.",
                      "properties": {
                        "destinationField": {
                          "description": "The field that will be populated by the results of the Regular Expression",
                          "type": "string"
                        },
                        "keepSourceField": {
                          "default": false,
                          "type": "boolean"
                        },
                        "sourceField": {
                          "description": "The field on which the Regular Expression will operate on.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "destinationField",
                        "sourceField"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "name": {
                      "description": "Name of the rule.",
                      "minLength": 0,
                      "type": "string"
                    },
                    "parse": {
                      "description": "Parse unstructured logs into JSON format using named Regular Expression groups.",
                      "properties": {
                        "destinationField": {
                          "description": "The field that will be populated by the results of the Regular Expression operation.",
                          "type": "string"
                        },
                        "regex": {
                          "description": "Regular Expression. More info: https://coralogix.com/blog/regex-101/",
                          "type": "string"
                        },
                        "sourceField": {
                          "description": "The field on which the Regular Expression will operate on.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "destinationField",
                        "regex",
                        "sourceField"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "parseJsonField": {
                      "description": "Convert JSON string to JSON object.",
                      "properties": {
                        "destinationField": {
                          "description": "The field that will be populated by the results of the Regular Expression",
                          "type": "string"
                        },
                        "keepDestinationField": {
                          "description": "Determines whether to keep or to delete the destination field.",
                          "type": "boolean"
                        },
                        "keepSourceField": {
                          "description": "Determines whether to keep or to delete the source field.",
                          "type": "boolean"
                        },
                        "sourceField": {
                          "description": "The field on which the Regular Expression will operate on.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "destinationField",
                        "keepDestinationField",
                        "keepSourceField",
                        "sourceField"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "removeFields": {
                      "description": "Remove Fields allows to select fields that will not be indexed.",
                      "properties": {
                        "excludedFields": {
                          "description": "Excluded fields won't be indexed.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "excludedFields"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "replace": {
                      "description": "Replace rules are used to strings in order to fix log structure, change log severity, or obscure information.",
                      "properties": {
                        "destinationField": {
                          "description": "The field that will be populated by the results of the Regular Expression operation.",
                          "type": "string"
                        },
                        "regex": {
                          "description": "Regular Expression. More info: https://coralogix.com/blog/regex-101/",
                          "type": "string"
                        },
                        "replacementString": {
                          "description": "The string that will replace the matched Regular Expression",
                          "type": "string"
                        },
                        "sourceField": {
                          "description": "The field on which the Regular Expression will operate on.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "destinationField",
                        "regex",
                        "replacementString",
                        "sourceField"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "name"
                  ],
                  "type": "object",
                  "x-kubernetes-validations": [
                    {
                      "message": "Exactly one of the following fields should be set: parse, block, jsonExtract, replace, extractTimestamp, removeFields, jsonStringify, extract, parseJsonField",
                      "rule": "(has(self.parse) ? 1 : 0) + (has(self.block) ? 1 : 0) + (has(self.jsonExtract) ? 1 : 0) + (has(self.replace) ? 1 : 0) + (has(self.extractTimestamp) ? 1 : 0) + (has(self.removeFields) ? 1 : 0) + (has(self.jsonStringify) ? 1 : 0) + (has(self.extract) ? 1 : 0) + (has(self.parseJsonField) ? 1 : 0) == 1"
                    }
                  ],
                  "additionalProperties": false
                },
                "type": "array"
              }
            },
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "subsystems": {
          "description": "Rules will execute on logs that match the these subsystems.",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "name"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "RuleGroupStatus defines the observed state of RuleGroup",
      "properties": {
        "conditions": {
          "items": {
            "description": "Condition contains details for one aspect of the current state of this API Resource.",
            "properties": {
              "lastTransitionTime": {
                "description": "lastTransitionTime is the last time the condition transitioned from one status to another.\nThis should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "message is a human readable message indicating details about the transition.\nThis may be an empty string.",
                "maxLength": 32768,
                "type": "string"
              },
              "observedGeneration": {
                "description": "observedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith respect to the current state of the instance.",
                "format": "int64",
                "minimum": 0,
                "type": "integer"
              },
              "reason": {
                "description": "reason contains a programmatic identifier indicating the reason for the condition's last transition.\nProducers of specific condition types may define expected values and meanings for this field,\nand whether the values are considered a guaranteed API.\nThe value should be a CamelCase string.\nThis field may not be empty.",
                "maxLength": 1024,
                "minLength": 1,
                "pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$",
                "type": "string"
              },
              "status": {
                "description": "status of the condition, one of True, False, Unknown.",
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ],
                "type": "string"
              },
              "type": {
                "description": "type of condition in CamelCase or in foo.example.com/CamelCase.",
                "maxLength": 316,
                "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$",
                "type": "string"
              }
            },
            "required": [
              "lastTransitionTime",
              "message",
              "reason",
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "id": {
          "type": "string"
        },
        "printableStatus": {
          "type": "string"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
