Change the index from winglogbeat to metricbeat

Hello elastic group, I have a question, I am trying to change the index from winglogbeat to metricbeat making the following configuration in the logstash (conf.d), but it has not worked for me, I would like to have your support.

output {
  if [agent][type] == "winlogbeat" {
        elasticsearch {
    hosts => ["https://URL-ELASTIC:9243"]
    index => "metricbeat-%{[@metadata][version]}-%{+YYYY.MM}"
    user => "elastic"
    password => "PASSWORD-ELASTIC"
  }
}
  else {
  elasticsearch {
    hosts => ["https://URL-ELASTIC:9243"]
    index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM}"
    user => "elastic"
    password => "PASSWORD-ELASTIC"
  }
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.