Replace default logs type with custom Type

In addition to the question I just raised, I would like to retain the type specified when calling Logstash (see curl request) - also within elastic. Right now, If I call logstash using the curl request below, Logstash Inserts the entry into Elastic with the logs type within the logstash-* index. What I'm looking to do is to use the aws-metrics as the type instead of logs default. How would I achieve this?

curl -H "content-type: application/json" -XPUT 'http://10.222.51.58:8080/aws-metrics' --data '@/C/Users/Temp/Desktop/my-file.json'

output {
	stdout { 
		codec => rubydebug
	} 
	if[request_path] == "/aws-metrics" {
		elasticsearch {
			hosts => ["https://elasticsearch.myhost.com:443/"]
			index => "myapp-ls-%{+YYYY.MM.dd}"
			user => "elastic"
			password => "elastic"
		}
	}
}

You could add 'document_type => "aws-metrics"' to the output, but note that types are being removed in V7.

1 Like

This works. Was trying out type => as suggested in some forum but it didnt work. wasnt able to create a google search strng enough to point to relevant resource. Thanks again.

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