curl --location --request PUT 'https://search-ingest-heenk2pp6ah4o3j4y3rkqvim3a.us-west-2.es.amazonaws.com/_ingest/pipeline/hwsi_tester' \
--header 'Content-Type: application/json' \
--data-raw '{
        "description": "Ingest Processor for HWSI Subsystem Tester Logs",
        "processors": [
            {
                "grok": {
                    "field": "message",
                    "patterns": [
                        "(?<tester_date>.{19})\\s(?<tester_dir>\\/.+)\\s(?<tester_cmd_num>\\d{1,5})\\s(?<tester_cmd>.+)"
                    ],
                    "if": "ctx.type == '\''hwsi_tester'\''",
                    "on_failure" : [
                        {
                          "append" : {
                            "field" : "tags",
                            "value" : ["failed to grok message"]
                          }
                        }
                      ]
                }
            },
            {
                "grok": {
                    "field": "log.file.path",
                    "patterns": [
                        "terminal_logs\/(?<tester_username>\\w+?)-"
                    ],
                    "if": "ctx.type == '\''hwsi_tester'\''",
                    "on_failure" : [
                        {
                          "append" : {
                            "field" : "tags",
                            "value" : ["failed to grok username from tester_dir"]
                          }
                        }
                      ]
                }
            },
            {
                "date": {
                    "field": "tester_date",
                    "target_field": "@timestamp",
                    "formats": [
                        "yyyy-MM-dd.HH:mm:ss"
                    ],
                    "timezone": "America/Los_Angeles",
                    "on_failure" : [
                        {
                          "append" : {
                            "field" : "tags",
                            "value" : ["ingest failed to process date"]
                          }
                        }
                      ]
                }
            }
        ]
    }'

