【问题标题】:Logstash not_analyzedLogstash not_analyzed
【发布时间】:2015-06-25 15:29:41
【问题描述】:

我是 ELK 堆栈的新手,可能会尝试设置一个非常复杂的配置以开始... :-)

我在 Windows 7 笔记本电脑上运行整个堆栈。我正在导入一个运行良好的 CSV,但我无法得到不分析的字符串字段,这在 kibana 可视化中给了我损坏的文本。

最后一次尝试是使用模板。

模板和conf文件都在c:\logstash-1.5.0\bin目录下。

这是配置文件:

input {  
  file {
      path => "C:\Users\jeroen\Documents\temp\CSV\ElasticSearch_Input_vc.csv"
      type => "core2"
      start_position => "beginning"      }
}

filter {  
csv {
    columns => ["snapshot_date_time","Country","Tower","Service","Division","USD Group","Ref Nr","Processtype","Importance","Priority","Severity","Status and Reason","Category","Is_Valid_Category","Summary","Open Date Time","Closed Date Time","Opened By","Last Modified","Resolve Completed Date Time","Hrs_Assigned_To_Completed","First Assign Date Time","Hrs_New_To_Assign","Customer Organization","Requested By","Assignee","Active Flag","In Out SLA Resolution 1"]

    separator => ";"
}
date
{ match => [ "snapshot_date_time", "yyyy-MM-dd HH:mm:ss" ] }
mutate {
convert => { "Hrs_Assigned_To_Completed" => "float" }
convert => { "Hrs_New_To_Assign" => "float" }
  }
}
output {  
elasticsearch {
    action => "index"
    host => "localhost"
    index => "qdb-%{+YYYY.MM.dd}"
    workers => 1
    template => "template.json"
}
#stdout {
   #codec => rubydebug
#}
}

这是模板(老实说,我只是从另一个主题复制并更改了“模板名称”)我不确定如何处理第 7 行,因为这可能特定于发起者使用的数据。 ..

#template.json:
{
"template": "qdb-%{+YYYY.MM.dd}",
"settings" : {
    "number_of_shards" : 1,
    "number_of_replicas" : 0,
    "index" : {"query" : { "default_field" : "userid" } 
    }
},
"mappings": {
    "_default_": { 
        "_all": { "enabled": false },
        "_source": { "compress": true },
        "dynamic_templates": [
            {
                "string_template" : { 
                    "match" : "*",
                    "mapping": { "type": "string", "index": "not_analyzed" },
                    "match_mapping_type" : "string"
                 } 
             }
         ],
         "properties" : {
            "date" : { "type" : "date", "format": "yyyy-MM-dd HH:mm:ss"},
            "device" : { "type" : "string", "fields": {"raw": {"type":  "string","index": 
"not_analyzed"}}},
            "distance" : { "type" : "integer"}
    }
}
}

感谢任何帮助/提示/提示!

【问题讨论】:

    标签: csv logstash kibana elastic-stack


    【解决方案1】:

    您需要在通过 logstash 导入数据后在第一个 ElasticSearch 中进行映射,然后您将在 Kibana 中看到未分析的数据

    http://host:9200/yourindex/_mapping/yourtype
    
    {
     "your type": {
     "properties": {
      "user" : {
        "type" : "string",
        "index": "not_analyzed",
      "data" : {
        "type" : "string",
        "index": "not_analyzed"
      }
        }
    

    【讨论】:

      【解决方案2】:

      你可以使用变量“.raw”

      例如,在我的配置中,我将 sourceip 设置为变量。

      在我的可视化中,我可以选择使用 sourcip.raw,这将是变量的“not_analyzed”版本。

      检查是否存在。

      【讨论】:

        猜你喜欢
        • 2015-09-27
        • 2015-12-24
        • 1970-01-01
        • 2015-01-31
        • 2016-05-08
        • 1970-01-01
        • 1970-01-01
        • 2014-02-05
        • 2016-02-18
        相关资源
        最近更新 更多