input {
stdin{
type => "${log_type:unknown}"
}
}
tried these and does not work
ruby{
code =>"event.set('[@metadata][log_type]','Atype')"
}
ruby{
code =>"$log_type = 'Atype'"
}
using logstash 5.0.0-alpha4
input {
stdin{
type => "${log_type:unknown}"
}
}
tried these and does not work
ruby{
code =>"event.set('[@metadata][log_type]','Atype')"
}
ruby{
code =>"$log_type = 'Atype'"
}
using logstash 5.0.0-alpha4
Why do you want to change an environment variable from inside Logstash? What's the underlying problem you want to solve, i.e. what you are trying to accomplish in the end?
I am trying to archive auto detection on log type
using existing patterns to test first 100 logs, which determine the log type it should use
and then parse all the log
I doubt type => "${log_type:unknown}"
is evaluated for each message so even if you'd be able to change the environment it might not work, but if you want to try it out the Ruby code would probably be ENV['log_type'] = 'Atype'
.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.