针对JMeter日志的ElasticSearch Kibana仪表板分析

时间:2014-11-05 11:09:58

标签: elasticsearch jmeter logstash kibana elasticsearch-plugin

我有一个来自JMeter的日志文件,其中包含以下列。

timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,grpThreads,allThreads,Latency,SampleCount,ErrorCount,Hostname

我已经能够在Kibana上生成一个图表,它给了我经过的时间。

但我无法搜索延迟。

直方图设置中是否有任何地方可以选择我想在时间戳和延迟或时间戳和ErrorCount之间绘制图表?

此外,我在JMeter中的时间戳被定义为“jmeter.save.saveservice.timestamp_format = yyyy-MM-dd'T'HH:mm:ss.SSSZ”

但我在ElasticSearch中收到错误

[2014-11-05 16:22:54,816][DEBUG][action.search.type       ] [Contrary] [shakespeare][2], node[S7Xyo1rSRGq6gzC9HtsCsg], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@453beee2] lastShard [true]
org.elasticsearch.search.SearchParseException: [shakespeare][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"facets":{"0":{"date_histogram":{"field":"@timestamp","interval":"1s"},"global":true,"facet_filter":{"fquery":{"query":{"filtered":{"query":{"query_string":{"query":"*"}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"from":1415141574791,"to":1415184774791}}}]}}}}}}}},"size":20,"query":{"filtered":{"query":{"query_string":{"query":"Latency"}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"from":1415141574791,"to":1415184774791}}}]}}}},"sort":[{"_score":{"order":"desc","ignore_unmapped":true}},{"@timestamp":{"order":"desc","ignore_unmapped":true}}]}]]

有什么办法可以解决这个错误吗?

谢谢,

1 个答案:

答案 0 :(得分:3)

不会直接回答您的问题,但会提供我们将jmeter结果导入logstash的方法

JmeterLog示例: 时间戳,和经过,标签,responseCode,responseMessage,threadName,字节,grpThreads,allThreads,网址,延迟 2014-11-05 09:43:56,13742,1加载推文Feed内容,200,OK,主题组1-964,4557,33,33,http://activity.flux.com/api/ActivityService/FindActivities2?cmId=12C6FFFF01DCE0D90002FFFFC612&cnId=12C6FFFF01DCE0D9001B01F459C3&dSCF=true&aFF=Twitter&mR=20&iT=true&iR=true&pAT=CommentContent&_t=1392986211131&skipCache=true&callback=FCA8AD20E&product=load_testing&productLocation=load_testing,13742

Logstash解析过滤器

  #Load Test data
  if [LogSeverityType] == "LoadTest" {
    if [Message] =~ "^time" {drop {}}
    grok{
    match => ["Message","%{TIMESTAMP_ISO8601:log_timestamp},%{NUMBER:elapsed},%{DATA:label},%{NUMBER:responseCode},%{DATA:responseMessage},%{DATA:threadName},%{NUMBER:bytes},%{NUMBER:grpThreads},%{NUMBER:allThreads},%{DATA:URL},%{NUMBER:Latency}"]
    }
    mutate {
      convert => [ "Latency", "integer" ]
      convert => [ "elapsed", "integer" ]
      convert => [ "grpThreads", "integer" ]
      convert => [ "allThreads", "integer" ]
      convert => [ "responseCode", "integer" ]
      convert => [ "bytes", "integer" ]
    }
    date {
      match => [ "log_timestamp", "YYYY-MM-dd HH:mm:ss", "ISO8601" ]
      timezone => "Etc/UCT"
    }
  }