/gologstash

logstash version with golang coding

Primary LanguageGo

gologstash

logstash version with golang coding 编译代码步骤如下: git clone https://github.com/kennyzhu2013/gologstash.git 注意GOPATH设为当前目录代码目录 go build github.com/mozilla-services/heka/cmd/gologstash go run hekad 运行:生成应用程序后如hekad -f config配置文件

配置文件用法示例: #协程个数... maxprocs = 4

[LogstreamerInput] decoder = "excel_transform_decoder" log_directory = "/data/servers/BetTest/GolangWork/heka/log" file_match = 'CaiNiXiHuan.txt'

[excel_transform_decoder] type = "PayloadRegexDecoder" match_regex = '^(?P\S+)\s+(?P\d+)\s+(?P\d+)\s+(?P\d+)\s+(?P\d+)\s+(?P\d+)\s+(?P\d+)\s+(?P\d+)\s+(?P\d+)\s+(?P\S+)' timestamp_layout = "02/Jan/2006:15:04:05 -0700"

[excel_transform_decoder.message_fields] Type = "CaiNiXiHuanfile" Logger = "/data/servers/BetTest/GolangWork/heka/log/CaiNiXiHuan.log" TryRate = "%TryRate%" Date|date-time = "%Date%" DetailVisitUsers|int|INTEGER = "%DetailVisitUsers%" DetailVisitCount|int|2 = "%DetailVisitCount%" VisitUsers|int|uint = "%VisitUsers%" VisitCount|int|uint = "%VisitCount%" TryDownLoadUsers|int|count = "%TryDownLoadUsers%" TryDownLoadCount|int|count = "%TryDownLoadCount%" DownLoadUsers|int|count = "%DownLoadUsers%" DownLoadCount|int|count = "%DownLoadCount%"

[ESJsonEncoder] ###append_newlines = false #es_index_from_timestamp = true index = "%{Type}-%{%Y.%m.%d}" type_name = "%{Type}"

#[LogOutput] #message_matcher = "TRUE" #encoder = "ESJsonEncoder"

[ElasticSearchOutput] message_matcher = "TRUE" server = "http://183.131.145.158:9200" encoder = "ESJsonEncoder"