logstash-perftool 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.rspec +3 -0
  4. data/CONTRIBUTORS +11 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +13 -0
  7. data/README.md +119 -0
  8. data/Rakefile +10 -0
  9. data/bin/lsperfm +9 -0
  10. data/bin/lsperfm-deps +32 -0
  11. data/examples/config/complex_syslog.conf +46 -0
  12. data/examples/config/json_inout_codec.conf +11 -0
  13. data/examples/config/json_inout_filter.conf +11 -0
  14. data/examples/config/simple.conf +11 -0
  15. data/examples/config/simple_grok.conf +13 -0
  16. data/examples/config/simple_json_out.conf +11 -0
  17. data/examples/input/apache_log.txt +30 -0
  18. data/examples/input/json_medium.txt +10 -0
  19. data/examples/input/simple_10.txt +10 -0
  20. data/examples/input/syslog_acl_10.txt +10 -0
  21. data/examples/suite/basic_performance_long.rb +18 -0
  22. data/examples/suite/basic_performance_quick.rb +18 -0
  23. data/lib/lsperfm.rb +22 -0
  24. data/lib/lsperfm/core.rb +81 -0
  25. data/lib/lsperfm/core/reporter.rb +21 -0
  26. data/lib/lsperfm/core/run.rb +139 -0
  27. data/lib/lsperfm/core/stats.rb +64 -0
  28. data/lib/lsperfm/defaults/config/complex_syslog.conf +46 -0
  29. data/lib/lsperfm/defaults/config/json_inout_codec.conf +11 -0
  30. data/lib/lsperfm/defaults/config/json_inout_filter.conf +11 -0
  31. data/lib/lsperfm/defaults/config/simple.conf +11 -0
  32. data/lib/lsperfm/defaults/config/simple_grok.conf +13 -0
  33. data/lib/lsperfm/defaults/config/simple_json_out.conf +11 -0
  34. data/lib/lsperfm/defaults/input/apache_log.txt +30 -0
  35. data/lib/lsperfm/defaults/input/json_medium.txt +10 -0
  36. data/lib/lsperfm/defaults/input/simple_10.txt +10 -0
  37. data/lib/lsperfm/defaults/input/syslog_acl_10.txt +10 -0
  38. data/lib/lsperfm/defaults/suite.rb +12 -0
  39. data/lib/lsperfm/defaults/suite/long.rb +18 -0
  40. data/lib/lsperfm/defaults/suite/quick.rb +18 -0
  41. data/lib/lsperfm/version.rb +5 -0
  42. data/logstash-perftool.gemspec +24 -0
  43. data/scripts/loader.rb +114 -0
  44. data/scripts/setup.sh +63 -0
  45. data/spec/fixtures/basic_suite.rb +4 -0
  46. data/spec/fixtures/config.yml +4 -0
  47. data/spec/fixtures/simple.conf +11 -0
  48. data/spec/fixtures/simple_10.txt +10 -0
  49. data/spec/fixtures/wrong_config.yml +4 -0
  50. data/spec/lib/runner_spec.rb +35 -0
  51. data/spec/lib/suite_spec.rb +51 -0
  52. data/spec/spec_helper.rb +9 -0
  53. data/suite.rb +46 -0
  54. metadata +154 -0
@@ -0,0 +1,30 @@
1
+ 83.149.9.216 - - [17/Sep/2014:07:13:42 +0000] "GET /presentations/logstash-monitorama-2013/images/kibana-search.png HTTP/1.1" 200 203023 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
2
+ 83.149.9.216 - - [17/Sep/2014:07:13:42 +0000] "GET /presentations/logstash-monitorama-2013/images/kibana-dashboard3.png HTTP/1.1" 200 171717 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
3
+ 83.149.9.216 - - [17/Sep/2014:07:13:44 +0000] "GET /presentations/logstash-monitorama-2013/plugin/highlight/highlight.js HTTP/1.1" 200 26185 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
4
+ 83.149.9.216 - - [17/Sep/2014:07:13:44 +0000] "GET /presentations/logstash-monitorama-2013/plugin/zoom-js/zoom.js HTTP/1.1" 200 7697 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
5
+ 83.149.9.216 - - [17/Sep/2014:07:13:45 +0000] "GET /presentations/logstash-monitorama-2013/plugin/notes/notes.js HTTP/1.1" 200 2892 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
6
+ 83.149.9.216 - - [17/Sep/2014:07:13:42 +0000] "GET /presentations/logstash-monitorama-2013/images/sad-medic.png HTTP/1.1" 200 430406 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
7
+ 83.149.9.216 - - [17/Sep/2014:07:13:45 +0000] "GET /presentations/logstash-monitorama-2013/css/fonts/Roboto-Bold.ttf HTTP/1.1" 200 38720 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
8
+ 83.149.9.216 - - [17/Sep/2014:07:13:45 +0000] "GET /presentations/logstash-monitorama-2013/css/fonts/Roboto-Regular.ttf HTTP/1.1" 200 41820 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
9
+ 83.149.9.216 - - [17/Sep/2014:07:13:45 +0000] "GET /presentations/logstash-monitorama-2013/images/frontend-response-codes.png HTTP/1.1" 200 52878 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
10
+ 83.149.9.216 - - [17/Sep/2014:07:13:43 +0000] "GET /presentations/logstash-monitorama-2013/images/kibana-dashboard.png HTTP/1.1" 200 321631 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
11
+ 83.149.9.216 - - [17/Sep/2014:07:13:46 +0000] "GET /presentations/logstash-monitorama-2013/images/Dreamhost_logo.svg HTTP/1.1" 200 2126 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
12
+ 83.149.9.216 - - [17/Sep/2014:07:13:43 +0000] "GET /presentations/logstash-monitorama-2013/images/kibana-dashboard2.png HTTP/1.1" 200 394967 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
13
+ 83.149.9.216 - - [17/Sep/2014:07:13:46 +0000] "GET /presentations/logstash-monitorama-2013/images/apache-icon.gif HTTP/1.1" 200 8095 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
14
+ 83.149.9.216 - - [17/Sep/2014:07:13:46 +0000] "GET /presentations/logstash-monitorama-2013/images/nagios-sms5.png HTTP/1.1" 200 78075 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
15
+ 83.149.9.216 - - [17/Sep/2014:07:13:46 +0000] "GET /presentations/logstash-monitorama-2013/images/redis.png HTTP/1.1" 200 25230 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
16
+ 83.149.9.216 - - [17/Sep/2014:07:13:47 +0000] "GET /presentations/logstash-monitorama-2013/images/elasticsearch.png HTTP/1.1" 200 8026 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
17
+ 83.149.9.216 - - [17/Sep/2014:07:13:47 +0000] "GET /presentations/logstash-monitorama-2013/images/logstashbook.png HTTP/1.1" 200 54662 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
18
+ 83.149.9.216 - - [17/Sep/2014:07:13:47 +0000] "GET /presentations/logstash-monitorama-2013/images/github-contributions.png HTTP/1.1" 200 34245 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
19
+ 83.149.9.216 - - [17/Sep/2014:07:13:47 +0000] "GET /presentations/logstash-monitorama-2013/css/print/paper.css HTTP/1.1" 200 4254 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
20
+ 83.149.9.216 - - [17/Sep/2014:07:13:47 +0000] "GET /presentations/logstash-monitorama-2013/images/1983_delorean_dmc-12-pic-38289.jpeg HTTP/1.1" 200 220562 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
21
+ 83.149.9.216 - - [17/Sep/2014:07:13:46 +0000] "GET /presentations/logstash-monitorama-2013/images/simple-inputs-filters-outputs.jpg HTTP/1.1" 200 1168622 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
22
+ 83.149.9.216 - - [17/Sep/2014:07:13:46 +0000] "GET /presentations/logstash-monitorama-2013/images/tiered-outputs-to-inputs.jpg HTTP/1.1" 200 1079983 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
23
+ 83.149.9.216 - - [17/Sep/2014:07:13:53 +0000] "GET /favicon.ico HTTP/1.1" 200 3638 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"
24
+ 24.236.252.67 - - [17/Sep/2014:07:14:10 +0000] "GET /favicon.ico HTTP/1.1" 200 3638 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0"
25
+ 93.114.45.13 - - [17/Sep/2014:07:14:32 +0000] "GET /articles/dynamic-dns-with-dhcp/ HTTP/1.1" 200 18848 "http://www.google.ro/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CCwQFjAB&url=http%3A%2F%2Fwww.semicomplete.com%2Farticles%2Fdynamic-dns-with-dhcp%2F&ei=W88AU4n9HOq60QXbv4GwBg&usg=AFQjCNEF1X4Rs52UYQyLiySTQxa97ozM4g&bvm=bv.61535280,d.d2k" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
26
+ 93.114.45.13 - - [17/Sep/2014:07:14:32 +0000] "GET /reset.css HTTP/1.1" 200 1015 "http://www.semicomplete.com/articles/dynamic-dns-with-dhcp/" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
27
+ 93.114.45.13 - - [17/Sep/2014:07:14:33 +0000] "GET /style2.css HTTP/1.1" 200 4877 "http://www.semicomplete.com/articles/dynamic-dns-with-dhcp/" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
28
+ 93.114.45.13 - - [17/Sep/2014:07:14:33 +0000] "GET /favicon.ico HTTP/1.1" 200 3638 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
29
+ 93.114.45.13 - - [17/Sep/2014:07:14:33 +0000] "GET /images/jordan-80.png HTTP/1.1" 200 6146 "http://www.semicomplete.com/articles/dynamic-dns-with-dhcp/" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
30
+ 93.114.45.13 - - [17/Sep/2014:07:14:33 +0000] "GET /images/web/2009/banner.png HTTP/1.1" 200 52315 "http://www.semicomplete.com/style2.css" "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
@@ -0,0 +1,10 @@
1
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
2
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
3
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
4
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
5
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
6
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
7
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
8
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
9
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
10
+ {"_scroll_id":"xxx", "took":5, "timed_out":false, "_shards":{"total":15,"successful":15,"failed":0}, "hits":{"total":1000050, "max_score":1.0, "hits":[{"_index":"logstash2", "_type":"logs", "_id":"AmaqL7VuSWKF-F6N_Gz72g", "_score":1.0, "_source" : {"message":"foobar", "@version":"1", "@timestamp":"2014-05-19T21:08:39.000Z", "host":"colin-mbp13r"} } ] } }
@@ -0,0 +1,10 @@
1
+ test 01
2
+ test 02
3
+ test 03
4
+ test 04
5
+ test 05
6
+ test 06
7
+ test 07
8
+ test 08
9
+ test 09
10
+ test 10
@@ -0,0 +1,10 @@
1
+ <164>Oct 26 15:19:25 1.2.3.4 %ASA-4-106023: Deny udp src DRAC:10.1.2.3/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
2
+ <164>Oct 6 15:20:25 2.2.3.4 %ASA-4-106023: Deny udp src DRAC:10.1.2.4/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
3
+ <164>Oct 1 15:21:25 3.2.3.4 %ASA-4-106023: Allow tcp src DRAC:10.1.2.5/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
4
+ <164>Oct 30 15:22:25 4.2.3.4 %ASA-4-106023: Allow tcp src DRAC:10.1.2.6/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
5
+ <164>Oct 26 15:19:25 1.2.3.4 %ASA-4-106023: Deny udp src DRAC:10.1.2.3/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
6
+ <164>Oct 6 15:20:25 2.2.3.4 %ASA-4-106023: Deny udp src DRAC:10.1.2.4/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
7
+ <164>Oct 1 15:21:25 3.2.3.4 %ASA-4-106023: Allow tcp src DRAC:10.1.2.5/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
8
+ <164>Oct 30 15:22:25 4.2.3.4 %ASA-4-106023: Allow tcp src DRAC:10.1.2.6/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
9
+ <164>Oct 26 15:19:25 1.2.3.4 %ASA-4-106023: Deny udp src DRAC:10.1.2.3/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
10
+ <164>Oct 6 15:20:25 2.2.3.4 %ASA-4-106023: Deny udp src DRAC:10.1.2.4/43434 dst outside:192.168.0.1/53 by access-group "acl_drac" [0x0, 0x0]
@@ -0,0 +1,12 @@
1
+ module LogStash::PerformanceMeter
2
+
3
+ base_dir = File.dirname(__FILE__)
4
+
5
+ DEFAULT_SUITE = [ { :name => "simple line in/out", :config => "#{base_dir}/config/simple.conf", :input => "#{base_dir}/input/simple_10.txt", :time => 120 },
6
+ { :name => "simple line in/json out", :config => "#{base_dir}/config/simple_json_out.conf", :input => "#{base_dir}/input/simple_10.txt", :time => 120 },
7
+ { :name => "json codec in/out", :config => "#{base_dir}/config/json_inout_codec.conf", :input => "#{base_dir}/input/json_medium.txt", :time => 120 },
8
+ { :name => "line in/json filter/json out", :config => "#{base_dir}/config/json_inout_filter.conf", :input => "#{base_dir}/input/json_medium.txt", :time => 120 },
9
+ { :name => "apache in/json out", :config => "#{base_dir}/config/simple.conf", :input => "#{base_dir}/input/apache_log.txt", :time => 120 },
10
+ { :name => "apache in/grok codec/json out", :config => "#{base_dir}/config/simple_grok.conf", :input => "#{base_dir}/input/apache_log.txt", :time => 120 },
11
+ { :name => "syslog in/json out", :config => "#{base_dir}/config/complex_syslog.conf", :input => "#{base_dir}/input/syslog_acl_10.txt", :time => 120} ]
12
+ end
@@ -0,0 +1,18 @@
1
+ # format description:
2
+ # each test can be executed by either target duration using :time => N secs
3
+ # or by number of events with :events => N
4
+ #
5
+ #[
6
+ # {:name => "simple json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :time => 30},
7
+ # {:name => "simple json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :events => 50000},
8
+ #]
9
+ #
10
+ [
11
+ {:name => "simple line in/out", :config => "config/simple.conf", :input => "input/simple_10.txt", :time => 120},
12
+ {:name => "simple line in/json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :time => 120},
13
+ {:name => "json codec in/out", :config => "config/json_inout_codec.conf", :input => "input/json_medium.txt", :time => 120},
14
+ {:name => "line in/json filter/json out", :config => "config/json_inout_filter.conf", :input => "input/json_medium.txt", :time => 120},
15
+ {:name => "apache in/json out", :config => "config/simple.conf", :input => "input/apache_log.txt", :time => 120},
16
+ {:name => "apache in/grok codec/json out", :config => "config/simple_grok.conf", :input => "input/apache_log.txt", :time => 120},
17
+ {:name => "syslog in/json out", :config => "config/complex_syslog.conf", :input => "input/syslog_acl_10.txt", :time => 120},
18
+ ]
@@ -0,0 +1,18 @@
1
+ # format description:
2
+ # each test can be executed by either target duration using :time => N secs
3
+ # or by number of events with :events => N
4
+ #
5
+ #[
6
+ # {:name => "simple json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :time => 30},
7
+ # {:name => "simple json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :events => 50000},
8
+ #]
9
+ #
10
+ [
11
+ {:name => "simple line in/out", :config => "config/simple.conf", :input => "input/simple_10.txt", :time => 30},
12
+ {:name => "simple line in/json out", :config => "config/simple_json_out.conf", :input => "input/simple_10.txt", :time => 30},
13
+ {:name => "json codec in/out", :config => "config/json_inout_codec.conf", :input => "input/json_medium.txt", :time => 30},
14
+ {:name => "line in/json filter/json out", :config => "config/json_inout_filter.conf", :input => "input/json_medium.txt", :time => 30},
15
+ {:name => "apache in/json out", :config => "config/simple.conf", :input => "input/apache_log.txt", :time => 30},
16
+ {:name => "apache in/grok codec/json out", :config => "config/simple_grok.conf", :input => "input/apache_log.txt", :time => 30},
17
+ {:name => "syslog in/json out", :config => "config/complex_syslog.conf", :input => "input/syslog_acl_10.txt", :time => 30},
18
+ ]
@@ -0,0 +1,5 @@
1
+ module LogStash
2
+ module PerformanceMeter
3
+ VERSION='0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/lsperfm/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Pere Urbon-Bayes"]
6
+ gem.email = ["pere.urbon@elastic.co"]
7
+ gem.description = %q{A performance testing tool for Logstash}
8
+ gem.summary = %q{With this gem you can run core performance test for your logstash-core pipeline}
9
+ gem.homepage = "http://logstash.net/"
10
+ gem.license = "Apache License (2.0)"
11
+
12
+ gem.files = `git ls-files`.split($\)
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "logstash-perftool"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = LogStash::PerformanceMeter::VERSION
17
+
18
+ gem.executables = ["lsperfm", "lsperfm-deps"]
19
+
20
+ gem.add_development_dependency "bundler", "~> 1.7"
21
+ gem.add_development_dependency "rake", "~> 10.0"
22
+ gem.add_development_dependency "rspec", '~> 3.3', '>= 3.3.0' #(MIT license)
23
+
24
+ end
data/scripts/loader.rb ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'elasticsearch'
4
+ require 'csv'
5
+
6
+ class Loader
7
+
8
+ def initialize(dir = "", debug = false)
9
+ @dir = dir
10
+ @debug = debug
11
+ end
12
+
13
+ def run
14
+ Dir.entries(@dir).each do |file|
15
+ absolute_path = File.join(@dir, file)
16
+ next if File.directory?(absolute_path)
17
+ load_file!(client, absolute_path)
18
+ end
19
+ end
20
+
21
+ def create_index
22
+ build_index client, index_config
23
+ end
24
+
25
+ private
26
+
27
+ def client
28
+ @client ||= Elasticsearch::Client.new log: @debug
29
+ end
30
+
31
+ def load_file!(client, file)
32
+ props = scrap_props(file)
33
+ puts "file: #{file} props: #{props}" if @debug
34
+ CSV.foreach(file, :headers => true) do |row|
35
+ puts "#{row.class}, #{row.count}, #{row.headers}" if @debug
36
+ row.headers.each do |header|
37
+ next if row.headers.first == header
38
+ content = build_body(row, header, props)
39
+ id = "#{props[:time]}#{props[:class]}#{content["type"]}#{content["kpi"]}".hash
40
+ client.index(index: 'logstash-benchmark', type: 'bench', id: id, body: content) rescue puts "failure with #{row}"
41
+ end
42
+ end
43
+ puts if @debug
44
+ end
45
+
46
+ def build_body(row, header, props)
47
+ type = row[0]
48
+ kpi = header
49
+ {
50
+ "class" => props[:class],
51
+ "type" => type,
52
+ "ts" => timestamp(props[:time]),
53
+ "kpi" => kpi,
54
+ "times" => row[header].to_i,
55
+ "_source" => "script"
56
+ }
57
+ end
58
+
59
+ def timestamp(time)
60
+ Time.at(time.to_i).strftime("%Y-%m-%dT%H:%M:%S.%3N%z")
61
+ end
62
+
63
+ def scrap_props(file)
64
+ match = /-(\d*.\d*)_(\d*).csv/.match(file)
65
+ {:class => match[1], :time => match[2] }
66
+ end
67
+
68
+ def build_index(client, params)
69
+ client.indices.create index: 'logstash-benchmark', body: params
70
+ end
71
+
72
+ def index_config
73
+ {:settings => index_settings, :mappings => index_mappings }
74
+ end
75
+
76
+ def index_settings
77
+ { analysis: {analyzer: {
78
+ label: {
79
+ stopwords: '_none_',
80
+ type: 'standard'
81
+ }
82
+ }}}
83
+ end
84
+
85
+ def index_mappings
86
+ props = { "name" => { "type" => "string" },
87
+ "class" => { "type" => "string" },
88
+ "type" => { "type" => "string", "index" => "not_analyzed" },
89
+ "kpi" => { "type" => "string", "index" => "not_analyzed" },
90
+ "ts" => { "type" => "date", "format" => "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "index" => "analyzed" },
91
+ "times" => { "type" => "integer" } }
92
+ { 'bench' => { '_source' => { 'enabled' => true }, 'properties' => props } }
93
+ end
94
+
95
+ end
96
+
97
+ @debug = !!ENV['DEBUG']
98
+
99
+ ## main function
100
+ if __FILE__ == $0
101
+ mode = ARGV[0]
102
+ if "i" == mode
103
+ puts "Loading the index definition"
104
+ Loader.new.create_index
105
+ puts "done"
106
+ elsif "m" == mode
107
+ puts "Loading data form the directory"
108
+ loader = Loader.new(ARGV[1], @debug)
109
+ loader.run
110
+ puts "done"
111
+ else
112
+ raise Exception.new("IllegalArgument: USAGE: loader [m|i] [path]")
113
+ end
114
+ end
data/scripts/setup.sh ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env bash
2
+
3
+ [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
4
+
5
+ TODAY=`date +%s`
6
+
7
+ VERSIONS=( 1.4.2 1.5.0 1.5.1 1.5.2 )
8
+ DEST_DIR="workspace"
9
+
10
+ mkdir -p $DEST_DIR
11
+
12
+ ## Download released versions.
13
+
14
+ for VERSION in "${VERSIONS[@]}"
15
+ do
16
+
17
+ FILENAME="logstash-$VERSION.tar.gz"
18
+ SOURCE_FILE="$DEST_DIR/$FILENAME"
19
+ DOWNLOAD_URL="https://download.elasticsearch.org/logstash/logstash/$FILENAME"
20
+
21
+ if [ ! -f $SOURCE_FILE ]; then
22
+ echo "Downloading $DOWNLOAD_URL"
23
+ wget $DOWNLOAD_URL -O $SOURCE_FILE
24
+ tar -xvzf $SOURCE_FILE -C $DEST_DIR
25
+ fi
26
+ done
27
+
28
+
29
+ ## Bootstrapping the environment
30
+ rvm use --create jruby-1.7.20@logstash-perfm
31
+ gem install logstash-perftool
32
+
33
+ cd $DEST_DIR
34
+ ## Run the report for each download package
35
+ for VERSION in "${VERSIONS[@]}"
36
+ do
37
+ cd "logstash-$VERSION"
38
+ rvm use jruby-1.7.20@logstash-perfm
39
+ lsperfm > "../logstash-$VERSION-$TODAY.log"
40
+ cd ..
41
+ done
42
+
43
+ ## Setup the current codebase
44
+ rm -rf "logstash"
45
+ git clone git@github.com:elastic/logstash.git
46
+ echo "jruby-1.7.20" > "logstash/.ruby-version"
47
+ echo "logstash-perfm" > "logstash/.ruby-gemset"
48
+
49
+ cd logstash
50
+
51
+ ## Running the benchmarks for each logstash repository branch
52
+ ## of interest.
53
+ BRANCHES=( master 1.5 )
54
+ for BRANCH in "${BRANCHES[@]}"
55
+ do
56
+ git checkout Gemfile
57
+ git checkout Gemfile.jruby-1.9.lock
58
+ git checkout $BRANCH
59
+ rm -rf vendor
60
+ rake bootstrap
61
+ lsperfm-deps
62
+ lsperfm > "../logstash-branch-$BRANCH-$TODAY.log"
63
+ done
@@ -0,0 +1,4 @@
1
+ [
2
+ {:name => "simple 1", :config => "simple.conf", :input => "simple_10.txt", :time => 5},
3
+ {:name => "simple 2", :config => "simple.conf", :input => "simple_10.txt", :time => 10},
4
+ ]
@@ -0,0 +1,4 @@
1
+ default:
2
+ path: 'spec/'
3
+ config: 'fixtures'
4
+ input: 'fixtures'
@@ -0,0 +1,11 @@
1
+ input {
2
+ stdin {}
3
+ }
4
+
5
+ filter {
6
+ clone {}
7
+ }
8
+
9
+ output {
10
+ stdout { codec => line }
11
+ }
@@ -0,0 +1,10 @@
1
+ test 01
2
+ test 02
3
+ test 03
4
+ test 04
5
+ test 05
6
+ test 06
7
+ test 07
8
+ test 08
9
+ test 09
10
+ test 10
@@ -0,0 +1,4 @@
1
+ default:
2
+ path: 'spec/'
3
+ config: 'wrong_fixture'
4
+ input: 'wrong_fixture'
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe LogStash::PerformanceMeter::Runner do
4
+
5
+ let(:config) { 'spec/fixtures/simple.conf' }
6
+ let(:lines) { load_fixture('simple_10.txt').split("\n") }
7
+
8
+ let(:events) { 30 }
9
+ let(:time) { 10 }
10
+
11
+ subject (:runner) { LogStash::PerformanceMeter::Runner.new(config) }
12
+
13
+ let(:command) { [File.join(Dir.pwd, LogStash::PerformanceMeter::Runner::LOGSTASH_BIN), "-f", "spec/fixtures/simple.conf"]}
14
+
15
+ it "invokes the logstash command" do
16
+ Open3.should_receive(:popen3).with(*command).and_return(true)
17
+ runner.run(events, 0, lines)
18
+ end
19
+
20
+ context "#execution with number of events" do
21
+
22
+ let(:io) { double("io", :puts => true, :flush => true) }
23
+ subject(:feed) { runner.feed_input_with(events, 0, lines, io) }
24
+
25
+ it "feeds in terms of events" do
26
+ expect(runner).to receive(:feed_input_events).with(io, events, lines, LogStash::PerformanceMeter::Runner::LAST_MESSAGE)
27
+ runner.feed_input_with(events, 0, lines, io)
28
+ end
29
+
30
+ it "feed the input stream with events.size+1 events" do
31
+ expect(feed).to eq(events.to_i)
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ describe LogStash::PerformanceMeter::Core do
4
+
5
+ let(:config) { 'spec/fixtures/config.yml' }
6
+ let(:logstash_home) { '.' }
7
+ let(:suite_def) { 'spec/fixtures/basic_suite.rb' }
8
+ let(:serial_runner) { double('DummySerialRunner') }
9
+ let(:runner) { LogStash::PerformanceMeter::Runner }
10
+
11
+ let(:run_outcome) { { :percentile => [2000] , :elapsed => 100, :events_count => 3000, :start_time => 12 } }
12
+ subject(:manager) { LogStash::PerformanceMeter::Core.new(suite_def, logstash_home, config, runner) }
13
+
14
+ context "with a valid configuration" do
15
+ before(:each) do
16
+ expect(serial_runner).to receive(:run).with(0, 5, anything()).ordered { run_outcome }
17
+ expect(serial_runner).to receive(:run).with(0, 10, anything()).ordered { run_outcome }
18
+ end
19
+ context "using a file" do
20
+
21
+ it "run each test case in a serial maner" do
22
+ expect(runner).to receive(:new).with("spec/fixtures/simple.conf", false, logstash_home).twice { serial_runner }
23
+ manager.run
24
+ end
25
+
26
+ end
27
+
28
+ context "without a file" do
29
+
30
+ let(:config) { '' }
31
+
32
+ it "run each test case as expected" do
33
+ expect(runner).to receive(:read_input_file).with('simple_10.txt').twice { [] }
34
+ expect(runner).to receive(:new).with("simple.conf", false, logstash_home).twice { serial_runner }
35
+ manager.run
36
+ end
37
+
38
+ end
39
+ end
40
+
41
+ context "with a wrong configuration" do
42
+
43
+ let(:config) { 'spec/fixtures/wrong_config.yml' }
44
+
45
+ it "run each test case as expected" do
46
+ expect(runner).to receive(:new).with("spec/wrong_fixture/simple.conf", false, logstash_home).once { serial_runner }
47
+ expect { manager.run }.to raise_error(LogStash::PerformanceMeter::ConfigException)
48
+ end
49
+ end
50
+
51
+ end