0

i ran into a problem. i have a pipeline:

input {
    tcp {
        host => "10.10.10.10"
        port => "5959"
        codec => "json"
        type => "my_type"
        mode => "server"
    }
}

filter {
 if [type] == "my_type" {
    grok {
        match => {"message" => ['\#%{GREEDYDATA:who}%{SPACE}#%{GREEDYDATA:what}\n\n%{GREEDYDATA}: %{GREEDYDATA:contact}%{SPACE} #%{GREEDYDATA:ident}\n%{GREEDYDATA}Cost:%{SPACE}%{DATA:cost}\n%{GREEDYDATA}Date:%{SPACE}%{DATE_EU:when}\n%{GREEDYDATA}Vacant:%{SPACE}%{DATA:vacant}\n(?<info>(.|\r|\n)*)\n\[%{GREEDYDATA}']
           }
       }

    mutate {
        gsub => [
            "what", "milkshake", "Milk ",
            "what", "icecream", "Ice "
            ]  
        }
        
    mutate {
        gsub => [
            "cost", "-1", "?",
            "contact", "9", "+9"
            ]  
        }
    
    mutate {
        gsub => [
            "contact", "\+9", "tel:+9"
            ]  
        }
        
      if [date] {
            date {
                match => [ "date", "ISO8601", "YYYY-MM-dd'T'HH:mm:ss.ZZZ" ]
                target => "@timestamp"
                } }

    if "_grokparsefailure" in [tags] {
    drop {}
            }
    }
}

output {
    if [type] == "my_type" {
        elasticsearch {
            hosts => ["https://localhost:9200"]
            index => "my_type-%{+xxxx.ww}"
            ilm_rollover_alias => "my_type"
            ilm_policy => "my_type"
            ilm_enabled => "true"
            cacert => ["/etc/logstash/ca.crt"]
            user => "elastic"
            password => "password"
        }
    }
}

in the mutate section after the GROK i replace one word with another which will contain emoji and be capitalized

mutate {
        gsub => [
            "what", "milkshake", "Milk ",
            "what", "icecream", "Ice "
            ]  
        }

but in elasticsearch in the "what" field I see that the word is substituted with a non-capital letter "milk " instead of "Milk "

I tried to force mutate for the capital letter, but that doesn't help either ("mutate" for the capital letter was placed after the "mutate" for replacement)

mutate {
        capitalize => [ "what" ]
    }

What can be wrong?

Aleksandr
  • 41
  • 1
  • 3

0 Answers0