in internal/elasticsearch/ingest/processor_kv_data_source.go [15:133]
func DataSourceProcessorKV() *schema.Resource {
processorSchema := map[string]*schema.Schema{
"id": {
Description: "Internal identifier of the resource",
Type: schema.TypeString,
Computed: true,
},
"field": {
Description: "The field to be parsed. Supports template snippets.",
Type: schema.TypeString,
Required: true,
},
"field_split": {
Description: "Regex pattern to use for splitting key-value pairs.",
Type: schema.TypeString,
Required: true,
},
"value_split": {
Description: "Regex pattern to use for splitting the key from the value within a key-value pair.",
Type: schema.TypeString,
Required: true,
},
"target_field": {
Description: "The field to insert the extracted keys into. Defaults to the root of the document.",
Type: schema.TypeString,
Optional: true,
},
"include_keys": {
Description: "List of keys to filter and insert into document. Defaults to including all keys",
Type: schema.TypeSet,
Optional: true,
MinItems: 1,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"exclude_keys": {
Description: "List of keys to exclude from document",
Type: schema.TypeSet,
Optional: true,
MinItems: 1,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"ignore_missing": {
Description: "If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document.",
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"prefix": {
Description: "Prefix to be added to extracted keys.",
Type: schema.TypeString,
Optional: true,
},
"trim_key": {
Description: "String of characters to trim from extracted keys.",
Type: schema.TypeString,
Optional: true,
},
"trim_value": {
Description: "String of characters to trim from extracted values.",
Type: schema.TypeString,
Optional: true,
},
"strip_brackets": {
Description: "If `true` strip brackets `()`, `<>`, `[]` as well as quotes `'` and `\"` from extracted values.",
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"description": {
Description: "Description of the processor. ",
Type: schema.TypeString,
Optional: true,
},
"if": {
Description: "Conditionally execute the processor",
Type: schema.TypeString,
Optional: true,
},
"ignore_failure": {
Description: "Ignore failures for the processor. ",
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"on_failure": {
Description: "Handle failures for the processor.",
Type: schema.TypeList,
Optional: true,
MinItems: 1,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringIsJSON,
DiffSuppressFunc: utils.DiffJsonSuppress,
},
},
"tag": {
Description: "Identifier for the processor.",
Type: schema.TypeString,
Optional: true,
},
"json": {
Description: "JSON representation of this data source.",
Type: schema.TypeString,
Computed: true,
},
}
return &schema.Resource{
Description: "This processor helps automatically parse messages (or specific event fields) which are of the foo=bar variety. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/kv-processor.html",
ReadContext: dataSourceProcessorKVRead,
Schema: processorSchema,
}
}