Logstash--基于logstash forwarder中设置的字段的动态索引
Logstash--Dynamic indexes on the basis of fields set in logstash forwarder
我想根据我在客户端计算机上的 logstash-forwarder 中设置的 'Application' 字段的值创建索引。
例如:
在 CRM 客户端的 logstash-forwarder.conf 中,我写
{
"paths": [
"/var/log/crm/crmERROR.log"
],
"fields": {**"**Application**":"CRM"**,"Sub-System":"Mysystem", "type":"Error-logs "
}
in LSF config on sales client 2 I say
{
"paths": [
"/var/log/sales/SalesERROR.log"
],
"fields": {**"Application":"Sales"**,"Sub-System":"Myststem", "type":"Error-logs "
}
所有这些日志将通过 LS-shipper 发送到 redis。 LS-indexer 将从 redis 中获取它。
现在在 LS-Indexer 中,我想根据字段 "Application" (CRM,Sales) 的值创建索引。如何获取应用程序字段的这些值,以便我可以在输出中使用它来创建索引名称。
br,
苏尼尔.
elasticsearch{} 输出允许您 specify the index name,例如:
output {
elasticsearch {
index => "logstash-%{+YYYY.MM.dd}"
}
}
您可以在索引名称中使用变量:
index => "%{my_field}-%{+YYYY.MM.dd}"
我想根据我在客户端计算机上的 logstash-forwarder 中设置的 'Application' 字段的值创建索引。 例如: 在 CRM 客户端的 logstash-forwarder.conf 中,我写
{
"paths": [
"/var/log/crm/crmERROR.log"
],
"fields": {**"**Application**":"CRM"**,"Sub-System":"Mysystem", "type":"Error-logs "
}
in LSF config on sales client 2 I say
{
"paths": [
"/var/log/sales/SalesERROR.log"
],
"fields": {**"Application":"Sales"**,"Sub-System":"Myststem", "type":"Error-logs "
}
所有这些日志将通过 LS-shipper 发送到 redis。 LS-indexer 将从 redis 中获取它。 现在在 LS-Indexer 中,我想根据字段 "Application" (CRM,Sales) 的值创建索引。如何获取应用程序字段的这些值,以便我可以在输出中使用它来创建索引名称。
br, 苏尼尔.
elasticsearch{} 输出允许您 specify the index name,例如:
output {
elasticsearch {
index => "logstash-%{+YYYY.MM.dd}"
}
}
您可以在索引名称中使用变量:
index => "%{my_field}-%{+YYYY.MM.dd}"