2013-10-29 57 views
3

我在嘗試獲取Logstash,Elasticsearch & Kibana在我的Windows 7環境中工作的組合很困難。由於缺少索引錯誤導致Logstash無法導入文件

我已經設置了所有3個,他們似乎都運行良好,Logstash和Elasticsearch作爲Windows服務和Kibana作爲IIS中的網站運行。

Logstash從http://localhost:9200

運行我有一個Web應用程序中的.txt創建日誌文件的格式:

Datetime=[DateTime], Value=[xxx]

日誌文件會在此目錄中創建的:

D:\wwwroot\Logs\Errors\

我的logstash.conf文件如下所示:

input { 

    file { 
    format => ["plain"] 
    path => ["D:\wwwroot\Logs\Errors\*.txt"] 
    type => "testlog" 
    } 
} 


output { 
    elasticsearch { 
     embedded => true 
    } 
} 

我Kibana config.js文件看起來像這樣:

define(['settings'], 
function (Settings) { 


return new Settings({ 

elasticsearch: "http://localhost:9200", 

kibana_index: "kibana-int", 

panel_names: [ 
    'histogram', 
    'map', 
    'pie', 
    'table', 
    'filtering', 
    'timepicker', 
    'text', 
    'fields', 
    'hits', 
    'dashcontrol', 
    'column', 
    'derivequeries', 
    'trends', 
    'bettermap', 
    'query', 
    'terms' 
] 
}); 
}); 

當我查看Kibana我看到的錯誤:

No index found at http://localhost:9200/_all/_mapping . Please create at least one index.If you're using a proxy ensure it is configured correctly.

我對如何創建索引不知道,所以如果任何人都可以對我做錯的事情有所瞭解,這將會很棒。

+0

看起來有在elasticsearch沒有數據?你是否開始用logstash索引東西?日誌文件logstash指向什麼東西? – javanna

+0

您是否在Windows中將logstash運行爲集中式或獨立版本?因爲我試圖找到一種在Windows中使用集中式選項的方法,但我不能。如果你做出任何幫助,對我來說將是非常寶貴的。 http://stackoverflow.com/questions/23907747/centralized-log-files-using-windows-server – foc

回答

3

目前似乎沒有什麼使它成爲elasticsearch。

對於當前版本的es(0.90.5),我不得不使用elasticsearch_http輸出。 elasticsearch的輸出似乎與0.90.3太密切相關。

e.g:這裏是我的配置是如何成爲log4j的格式,以彈性搜索

input { 
    file { 
    path => "/srv/wso2/wso2am-1.4.0/repository/logs/wso2carbon.log" 
    path => "/srv/wso2/wso2as-5.1.0/repository/logs/wso2carbon.log" 
    path => "/srv/wso2/wso2is-4.1.0/repository/logs/wso2carbon.log" 
    type => "log4j" 
    } 
} 

output { 
    stdout { debug => true debug_format => "ruby"} 

    elasticsearch_http { 
    host => "localhost" 
    port => 9200  
    } 
} 

對於我的文件格式,我有一個神交過濾器,以及 - 正確地解析它。

filter { 
     if [message] !~ "^[ \t\n]+$" { 
     # if the line is a log4j type 
     if [type] == "log4j" { 
      # parse out fields from log4j line 
      grok { 
      match => [ "message", "TID:%{SPACE}\[%{BASE10NUM:thread_name}\]%{SPACE}\[%{WORD:component}\]%{SPACE}\[%{TIMESTAMP_ISO8601:timestamp}\]%{SPACE}%{LOGLEVEL:level}%{SPACE}{%{JAVACLASS:java_file}}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}" ] 
      add_tag => ["test"] 
      } 

      if "_grokparsefailure" not in [tags] { 
      mutate { 
       replace => ["message", " "] 
      } 
      } 
      multiline { 
      pattern => "^TID|^ $" 
      negate => true 
      what => "previous" 
      add_field => {"additional_log" => "%{message}"} 
      remove_field => ["message"] 
      remove_tag => ["_grokparsefailure"] 
      } 
      mutate { 
      strip => ["additional_log"] 
      remove_tag => ["test"] 
      remove_field => ["message"] 
      } 

     } 
     } else { 
     drop {} 
     } 
    } 

而且,我會得到elasticsearch頭插件監視elasticsearch-你的內容很容易驗證的數據和狀態,它是英寸

+0

感謝你,我將嘗試使用elasticsearch_http和相同的格式作爲您的logstash.conf文件。會讓你知道我如何繼續。 – Nanz

+0

@Tim'elasticsearch'和'elasticsearch_http'有什麼不同? –

+0

隨着elasticsearch輸出logstash將加入elasticsearch集羣。通過elasticsearch_http,輸出將通過http進行輸入。 – itsafire

相關問題