filter {
  if [fields][apache_log_type] == "access_log" {
    grok {
      match => { "message" => "%{COMBINEDAPACHELOG}( %{NUMBER:duration_ms})?" }
    }
    date {
      match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
    }
    mutate {
      add_field => {
        "[@metadata][target_index]" => "apache_logs-%{+YYYY.MM.dd}"
      }
      convert => {
        "response" => "integer"
        "duration_ms" => "integer"
      }
    }
  } else if "swh-worker@" in [systemd_unit] {
    mutate {
      add_field => {
        "[@metadata][target_index]" => "swh_workers-%{+YYYY.MM.dd}"
      }
    }
  } else {
    mutate {
      add_field => {
        "[@metadata][target_index]" => "systemlogs-%{+YYYY.MM.dd}"
      }
    }
  }
}

filter {
  if [fields][apache_log_type] == "access_log" {
    grok {
      match => { "message" => "%{COMBINEDAPACHELOG}( %{NUMBER:duration_ms})?" }
    }
    date {
      match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
    }
    mutate {
      add_field => {
        "[@metadata][target_index]" => "apache_logs-%{+YYYY.MM.dd}"
      }
      convert => {
        "response" => "integer"
        "duration_ms" => "integer"
        "bytes" => "integer"
      }
    }
  } else if "swh-worker@" in [systemd_unit] {
    mutate {
      add_field => {
        "[@metadata][target_index]" => "swh_workers-%{+YYYY.MM.dd}"
      }
    }
  } else {
    mutate {
      add_field => {
        "[@metadata][target_index]" => "systemlogs-%{+YYYY.MM.dd}"
      }
    }
  }
}

Allow to perform numerical operations on bytes
logstash: Allow to perform numerical operations on bytes

The bytes field also needs to be converted to an integer
to be able to compute sum or average operations on it

Related to T2787
