Hi
ES 2.4.0
Logstash 5.1.1
I want to send the slowlogs to .csv file using logstash . my config file is like this
input {
file {
path => "D:\logstash-5.1.1\logstash-5.1.1\bin\slowlog.log"
start_position => "beginning"
}
}
filter {
grok { # parses the common bits
match => [ "message", "[%{TIMESTAMP_ISO8601:TIMESTAMP}][%{LOGLEVEL:LEVEL}%{SPACE}][%{DATA:QUERY}]%{SPACE}[%{DATA:QUERY1}]%{SPACE}[%{DATA:INDEX-NAME}][%{DATA:SHARD}]%{SPACE}took[%{DATA:TOOK}],%{SPACE}took_millis[%{DATA:TOOKM}], types[%{DATA:types}], stats[%{DATA:stats}], search_type[%{DATA:search_type}], total_shards[%{NUMBER:total_shards}], source[%{DATA:source_query}], extra_source[%{DATA:extra_source}],"]
}
}
output {
csv {
fields => ["TIMESTAMP","LOGLEVEL","QUERY","QUERY1","INDEX-NAME","SHARD","TOOK","took_millis","types","stats","search_type","total_shards","source_query","extra_source"]
path => "D:\logstash-5.1.1\logstash-5.1.1\bin\final.csv"
}
stdout { codec => rubydebug }
}
my output is coming in a irrregular format like
2017-01-17T06:35:26.236Z PC147594 [2017-01-13 12:58:09 843][WARN ][index.search.slowlog.query] [Spectra] [testindex-stats][2] took[15.3ms] took_millis[15] types stats search_type[QUERY_THEN_FETCH] total_shards[5] source[{"query":{"match":{"text":"ronin"}}}] extra_source
My logs format is
[2017-01-13 21:21:03,956][WARN ][index.search.slowlog.query] [Yaswanth] [bank][0] took[28.9ms], took_millis[28], types, stats, search_type[QUERY_THEN_FETCH], total_shards[5], source, extra_source,
My output should be like every field in logs squarebrackets should in one ,one column like 2017-01-13 21:21:03,956 in one column WARN in one column index.search.slowlog.query in one column so on..
can anyone help me in solving this?