【问题标题】:Logstash just gives me two logsLogstash 只给了我两个日志
【发布时间】:2015-02-17 18:10:56
【问题描述】:

←[33m使用里程碑2输入插件'文件'。这个插件应该是稳定的,但是如果 你看到奇怪的行为,请告诉我们!有关插件 mi 的更多信息 lestones,见http://logstash.net/docs/1.4.2/plugin-milestones {:level=>:warn}←[ 0米 ←[33m使用里程碑2过滤插件'csv'。这个插件应该是稳定的,但是如果 你看到奇怪的行为,请告诉我们!有关插件 mi 的更多信息 lestones,见http://logstash.net/docs/1.4.2/plugin-milestones {:level=>:warn}←[ 0米

我的配置:

input {
file {
path => [ "e:\mycsvfile.csv" ]
start_position => "beginning"
}
}
filter {
csv {
columns => ["col1","col2"]
source => "csv_data"
separator => ","
}
}

output {
elasticsearch { 
host => localhost
port => 9200
index => test
index_type => test_type
protocol => http
}
stdout { 
codec => rubydebug
}
}

我的环境: 视窗 8 日志存储 1.4.2

问题:以前有没有人经历过这种情况? logstash 日志在哪里? Windows 上是否存在已知的 logstash 错误?我的经验是logstash 没有做任何事情。

我试过了:

logstash.bat agent -f test.conf --verbose
←[33mUsing milestone 2 input plugin 'file'. This plugin should be stable, but if
you see strange behavior, please let us know! For more information on plugin mi
lestones, see http://logstash.net/docs/1.4.2/plugin-milestones {:level=>:warn}←[
0m
←[33mUsing milestone 2 filter plugin 'csv'. This plugin should be stable, but if
you see strange behavior, please let us know! For more information on plugin mi
lestones, see http://logstash.net/docs/1.4.2/plugin-milestones {:level=>:warn}←[
0m
←[32mRegistering file input {:path=>["e:/temp.csv"], :level=>:info}←[0m
←[32mNo sincedb_path set, generating one based on the file path {:sincedb_path=>
"C:\Users\gemini/.sincedb_d8e46c18292a898ea0b5b1cd94987f21", :path=>["e:/tem
p.csv"], :level=>:info}←[0m
←[32mPipeline started {:level=>:info}←[0m
←[32mNew Elasticsearch output {:cluster=>nil, :host=>"localhost", :port=>9200, :
embedded=>false, :protocol=>"http", :level=>:info}←[0m
←[32mAutomatic template management enabled {:manage_template=>"true", :level=>:i
nfo}←[0m
←[32mUsing mapping template {:template=>"{ \"template\" : \"logstash-\", \"se
ttings\" : { \"index.refresh_interval\" : \"5s\" }, \"mappings\" : { \"_
default_\" : { \"_all\" : {\"enabled\" : true}, \"dynamic_templates\
" : [ { \"string_fields\" : { \"match\" : \"\", \"m
atch_mapping_type\" : \"string\", \"mapping\" : { \"type\"
: \"string\", \"index\" : \"analyzed\", \"omit_norms\" : true, \"
fields\" : { \"raw\" : {\"type\": \"string\", \"index\" : \"not_
analyzed\", \"ignore_above\" : 256} } } }
} ], \"properties\" : { \"@version\": { \"type\": \"string\", \"in
dex\": \"not_analyzed\" }, \"geoip\" : { \"type\" : \"object\
", \"dynamic\": true, \"path\": \"full\", \"
properties\" : { \"location\" : { \"type\" : \"geo_point\" }
} } } } }}", :level=>:info}←[0m

暂时这样,在elasticsearch中没有创建新的索引。

【问题讨论】:

  • 您有问题吗?
  • 对不起。我编辑了我的问题。谢谢
  • 如果你的文件有两个数据行,你应该在elasticsearch中得到两个文档。您将不得不向我们提供更多信息。
  • 我刚刚更新了问题以向您展示更详细的结果。我有两行数据,第一行包含字段名称,第二行包含一组数据。

标签: elasticsearch logstash


【解决方案1】:

我必须补充:

sincedb_path => "NIL"

它奏效了。

http://logstash.net/docs/1.1.0/inputs/file#setting_sincedb_path

sincedb_path 值类型是字符串 这个没有默认值 环境。在哪里写入以来数据库(跟踪当前 监控日志文件的位置)。默认为环境值 变量“$SINCEDB_PATH”或“$HOME/.sincedb”。

我的 C:\users{user} 中生成了几个 sincedb 文件。

【讨论】:

  • 所以,又发生了。原来,当我添加“NIL”时,它会在我的 bin 目录中生成一个 NIL 文件,因为那是我的配置文件所在的位置。我想,如果我们想重置logstash,正确的方法是删除sincedb* 生成的文件。就我而言,我将删除 sincedb_path => "NIL",并让它默认为我的 $HOME 路径。每当我想进行重置时,我都会删除在我的 $HOME 路径中生成的 sincedb 文件。
【解决方案2】:

使用 CSV 作为输入数据时,我必须添加:

sincedb_path => 文件内的“NIL”{} json

例子:

input {
file {
    path => [ "C:/csvfilename.txt"]
    start_position => "beginning"
    sincedb_path => "NIL"
}

}

它适用于logstash 1.4.2版

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-29
    • 1970-01-01
    相关资源
    最近更新 更多