logstash-lib 1.3.2

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 (419) hide show
  1. data/.gitignore +24 -0
  2. data/.tailor +8 -0
  3. data/.travis.yml +12 -0
  4. data/CHANGELOG +1185 -0
  5. data/CONTRIBUTING.md +61 -0
  6. data/CONTRIBUTORS +79 -0
  7. data/LICENSE +14 -0
  8. data/Makefile +460 -0
  9. data/README.md +120 -0
  10. data/STYLE.md +96 -0
  11. data/bin/logstash +37 -0
  12. data/bin/logstash-test +4 -0
  13. data/bin/logstash-web +4 -0
  14. data/bin/logstash.lib.sh +78 -0
  15. data/bot/check_pull_changelog.rb +89 -0
  16. data/docs/configuration.md +260 -0
  17. data/docs/docgen.rb +242 -0
  18. data/docs/extending/example-add-a-new-filter.md +121 -0
  19. data/docs/extending/index.md +91 -0
  20. data/docs/flags.md +43 -0
  21. data/docs/generate_index.rb +28 -0
  22. data/docs/index.html.erb +56 -0
  23. data/docs/learn.md +46 -0
  24. data/docs/life-of-an-event.md +109 -0
  25. data/docs/logging-tool-comparisons.md +60 -0
  26. data/docs/plugin-doc.html.erb +91 -0
  27. data/docs/plugin-milestones.md +41 -0
  28. data/docs/plugin-synopsis.html.erb +24 -0
  29. data/docs/release-engineering.md +46 -0
  30. data/docs/release-test-results.md +14 -0
  31. data/docs/repositories.md +35 -0
  32. data/docs/tutorials/10-minute-walkthrough/apache-elasticsearch.conf +35 -0
  33. data/docs/tutorials/10-minute-walkthrough/apache-parse.conf +33 -0
  34. data/docs/tutorials/10-minute-walkthrough/apache_log.1 +1 -0
  35. data/docs/tutorials/10-minute-walkthrough/apache_log.2.bz2 +0 -0
  36. data/docs/tutorials/10-minute-walkthrough/hello-search.conf +25 -0
  37. data/docs/tutorials/10-minute-walkthrough/hello.conf +16 -0
  38. data/docs/tutorials/10-minute-walkthrough/index.md +124 -0
  39. data/docs/tutorials/10-minute-walkthrough/step-5-output.txt +17 -0
  40. data/docs/tutorials/getting-started-centralized-overview-diagram.png +0 -0
  41. data/docs/tutorials/getting-started-centralized-overview-diagram.xml +1 -0
  42. data/docs/tutorials/getting-started-centralized.md +217 -0
  43. data/docs/tutorials/getting-started-simple.md +200 -0
  44. data/docs/tutorials/just-enough-rabbitmq-for-logstash.md +201 -0
  45. data/docs/tutorials/media/frontend-response-codes.png +0 -0
  46. data/docs/tutorials/metrics-from-logs.md +84 -0
  47. data/docs/tutorials/zeromq.md +118 -0
  48. data/extract_services.rb +29 -0
  49. data/gembag.rb +64 -0
  50. data/lib/logstash-event.rb +2 -0
  51. data/lib/logstash.rb +4 -0
  52. data/lib/logstash/JRUBY-6970-openssl.rb +22 -0
  53. data/lib/logstash/JRUBY-6970.rb +102 -0
  54. data/lib/logstash/agent.rb +305 -0
  55. data/lib/logstash/certs/cacert.pem +3895 -0
  56. data/lib/logstash/codecs/base.rb +49 -0
  57. data/lib/logstash/codecs/compress_spooler.rb +50 -0
  58. data/lib/logstash/codecs/dots.rb +18 -0
  59. data/lib/logstash/codecs/edn.rb +28 -0
  60. data/lib/logstash/codecs/edn_lines.rb +36 -0
  61. data/lib/logstash/codecs/fluent.rb +55 -0
  62. data/lib/logstash/codecs/graphite.rb +114 -0
  63. data/lib/logstash/codecs/json.rb +41 -0
  64. data/lib/logstash/codecs/json_lines.rb +52 -0
  65. data/lib/logstash/codecs/json_spooler.rb +22 -0
  66. data/lib/logstash/codecs/line.rb +58 -0
  67. data/lib/logstash/codecs/msgpack.rb +43 -0
  68. data/lib/logstash/codecs/multiline.rb +189 -0
  69. data/lib/logstash/codecs/netflow.rb +342 -0
  70. data/lib/logstash/codecs/netflow/util.rb +212 -0
  71. data/lib/logstash/codecs/noop.rb +19 -0
  72. data/lib/logstash/codecs/oldlogstashjson.rb +56 -0
  73. data/lib/logstash/codecs/plain.rb +48 -0
  74. data/lib/logstash/codecs/rubydebug.rb +22 -0
  75. data/lib/logstash/codecs/spool.rb +38 -0
  76. data/lib/logstash/config/Makefile +4 -0
  77. data/lib/logstash/config/config_ast.rb +380 -0
  78. data/lib/logstash/config/file.rb +39 -0
  79. data/lib/logstash/config/grammar.rb +3504 -0
  80. data/lib/logstash/config/grammar.treetop +241 -0
  81. data/lib/logstash/config/mixin.rb +464 -0
  82. data/lib/logstash/config/registry.rb +13 -0
  83. data/lib/logstash/config/test.conf +18 -0
  84. data/lib/logstash/errors.rb +10 -0
  85. data/lib/logstash/event.rb +262 -0
  86. data/lib/logstash/filters/advisor.rb +178 -0
  87. data/lib/logstash/filters/alter.rb +173 -0
  88. data/lib/logstash/filters/anonymize.rb +93 -0
  89. data/lib/logstash/filters/base.rb +190 -0
  90. data/lib/logstash/filters/checksum.rb +50 -0
  91. data/lib/logstash/filters/cidr.rb +76 -0
  92. data/lib/logstash/filters/cipher.rb +145 -0
  93. data/lib/logstash/filters/clone.rb +35 -0
  94. data/lib/logstash/filters/collate.rb +114 -0
  95. data/lib/logstash/filters/csv.rb +94 -0
  96. data/lib/logstash/filters/date.rb +244 -0
  97. data/lib/logstash/filters/dns.rb +201 -0
  98. data/lib/logstash/filters/drop.rb +32 -0
  99. data/lib/logstash/filters/elapsed.rb +256 -0
  100. data/lib/logstash/filters/elasticsearch.rb +73 -0
  101. data/lib/logstash/filters/environment.rb +27 -0
  102. data/lib/logstash/filters/extractnumbers.rb +84 -0
  103. data/lib/logstash/filters/gelfify.rb +52 -0
  104. data/lib/logstash/filters/geoip.rb +145 -0
  105. data/lib/logstash/filters/grep.rb +153 -0
  106. data/lib/logstash/filters/grok.rb +425 -0
  107. data/lib/logstash/filters/grokdiscovery.rb +75 -0
  108. data/lib/logstash/filters/i18n.rb +51 -0
  109. data/lib/logstash/filters/json.rb +90 -0
  110. data/lib/logstash/filters/json_encode.rb +52 -0
  111. data/lib/logstash/filters/kv.rb +232 -0
  112. data/lib/logstash/filters/metaevent.rb +68 -0
  113. data/lib/logstash/filters/metrics.rb +237 -0
  114. data/lib/logstash/filters/multiline.rb +241 -0
  115. data/lib/logstash/filters/mutate.rb +399 -0
  116. data/lib/logstash/filters/noop.rb +21 -0
  117. data/lib/logstash/filters/prune.rb +149 -0
  118. data/lib/logstash/filters/punct.rb +32 -0
  119. data/lib/logstash/filters/railsparallelrequest.rb +86 -0
  120. data/lib/logstash/filters/range.rb +142 -0
  121. data/lib/logstash/filters/ruby.rb +42 -0
  122. data/lib/logstash/filters/sleep.rb +111 -0
  123. data/lib/logstash/filters/split.rb +64 -0
  124. data/lib/logstash/filters/sumnumbers.rb +73 -0
  125. data/lib/logstash/filters/syslog_pri.rb +107 -0
  126. data/lib/logstash/filters/translate.rb +121 -0
  127. data/lib/logstash/filters/unique.rb +29 -0
  128. data/lib/logstash/filters/urldecode.rb +57 -0
  129. data/lib/logstash/filters/useragent.rb +112 -0
  130. data/lib/logstash/filters/uuid.rb +58 -0
  131. data/lib/logstash/filters/xml.rb +139 -0
  132. data/lib/logstash/filters/zeromq.rb +123 -0
  133. data/lib/logstash/filterworker.rb +122 -0
  134. data/lib/logstash/inputs/base.rb +125 -0
  135. data/lib/logstash/inputs/collectd.rb +306 -0
  136. data/lib/logstash/inputs/drupal_dblog.rb +323 -0
  137. data/lib/logstash/inputs/drupal_dblog/jdbcconnection.rb +66 -0
  138. data/lib/logstash/inputs/elasticsearch.rb +140 -0
  139. data/lib/logstash/inputs/eventlog.rb +129 -0
  140. data/lib/logstash/inputs/eventlog/racob_fix.rb +44 -0
  141. data/lib/logstash/inputs/exec.rb +69 -0
  142. data/lib/logstash/inputs/file.rb +146 -0
  143. data/lib/logstash/inputs/ganglia.rb +127 -0
  144. data/lib/logstash/inputs/ganglia/gmondpacket.rb +146 -0
  145. data/lib/logstash/inputs/ganglia/xdr.rb +327 -0
  146. data/lib/logstash/inputs/gelf.rb +138 -0
  147. data/lib/logstash/inputs/gemfire.rb +222 -0
  148. data/lib/logstash/inputs/generator.rb +97 -0
  149. data/lib/logstash/inputs/graphite.rb +41 -0
  150. data/lib/logstash/inputs/heroku.rb +51 -0
  151. data/lib/logstash/inputs/imap.rb +136 -0
  152. data/lib/logstash/inputs/irc.rb +84 -0
  153. data/lib/logstash/inputs/log4j.rb +136 -0
  154. data/lib/logstash/inputs/lumberjack.rb +53 -0
  155. data/lib/logstash/inputs/pipe.rb +57 -0
  156. data/lib/logstash/inputs/rabbitmq.rb +126 -0
  157. data/lib/logstash/inputs/rabbitmq/bunny.rb +118 -0
  158. data/lib/logstash/inputs/rabbitmq/hot_bunnies.rb +1 -0
  159. data/lib/logstash/inputs/rabbitmq/march_hare.rb +129 -0
  160. data/lib/logstash/inputs/redis.rb +263 -0
  161. data/lib/logstash/inputs/relp.rb +106 -0
  162. data/lib/logstash/inputs/s3.rb +279 -0
  163. data/lib/logstash/inputs/snmptrap.rb +87 -0
  164. data/lib/logstash/inputs/sqlite.rb +185 -0
  165. data/lib/logstash/inputs/sqs.rb +172 -0
  166. data/lib/logstash/inputs/stdin.rb +46 -0
  167. data/lib/logstash/inputs/stomp.rb +84 -0
  168. data/lib/logstash/inputs/syslog.rb +237 -0
  169. data/lib/logstash/inputs/tcp.rb +231 -0
  170. data/lib/logstash/inputs/threadable.rb +18 -0
  171. data/lib/logstash/inputs/twitter.rb +82 -0
  172. data/lib/logstash/inputs/udp.rb +81 -0
  173. data/lib/logstash/inputs/unix.rb +163 -0
  174. data/lib/logstash/inputs/varnishlog.rb +48 -0
  175. data/lib/logstash/inputs/websocket.rb +50 -0
  176. data/lib/logstash/inputs/wmi.rb +72 -0
  177. data/lib/logstash/inputs/xmpp.rb +81 -0
  178. data/lib/logstash/inputs/zenoss.rb +143 -0
  179. data/lib/logstash/inputs/zeromq.rb +165 -0
  180. data/lib/logstash/kibana.rb +113 -0
  181. data/lib/logstash/loadlibs.rb +9 -0
  182. data/lib/logstash/logging.rb +89 -0
  183. data/lib/logstash/monkeypatches-for-bugs.rb +2 -0
  184. data/lib/logstash/monkeypatches-for-debugging.rb +47 -0
  185. data/lib/logstash/monkeypatches-for-performance.rb +66 -0
  186. data/lib/logstash/multiqueue.rb +53 -0
  187. data/lib/logstash/namespace.rb +16 -0
  188. data/lib/logstash/outputs/base.rb +120 -0
  189. data/lib/logstash/outputs/boundary.rb +116 -0
  190. data/lib/logstash/outputs/circonus.rb +78 -0
  191. data/lib/logstash/outputs/cloudwatch.rb +351 -0
  192. data/lib/logstash/outputs/csv.rb +55 -0
  193. data/lib/logstash/outputs/datadog.rb +93 -0
  194. data/lib/logstash/outputs/datadog_metrics.rb +123 -0
  195. data/lib/logstash/outputs/elasticsearch.rb +332 -0
  196. data/lib/logstash/outputs/elasticsearch/elasticsearch-template.json +44 -0
  197. data/lib/logstash/outputs/elasticsearch_http.rb +256 -0
  198. data/lib/logstash/outputs/elasticsearch_river.rb +214 -0
  199. data/lib/logstash/outputs/email.rb +299 -0
  200. data/lib/logstash/outputs/exec.rb +40 -0
  201. data/lib/logstash/outputs/file.rb +180 -0
  202. data/lib/logstash/outputs/ganglia.rb +75 -0
  203. data/lib/logstash/outputs/gelf.rb +208 -0
  204. data/lib/logstash/outputs/gemfire.rb +103 -0
  205. data/lib/logstash/outputs/google_bigquery.rb +570 -0
  206. data/lib/logstash/outputs/google_cloud_storage.rb +431 -0
  207. data/lib/logstash/outputs/graphite.rb +143 -0
  208. data/lib/logstash/outputs/graphtastic.rb +185 -0
  209. data/lib/logstash/outputs/hipchat.rb +80 -0
  210. data/lib/logstash/outputs/http.rb +142 -0
  211. data/lib/logstash/outputs/irc.rb +80 -0
  212. data/lib/logstash/outputs/jira.rb +109 -0
  213. data/lib/logstash/outputs/juggernaut.rb +105 -0
  214. data/lib/logstash/outputs/librato.rb +146 -0
  215. data/lib/logstash/outputs/loggly.rb +93 -0
  216. data/lib/logstash/outputs/lumberjack.rb +51 -0
  217. data/lib/logstash/outputs/metriccatcher.rb +103 -0
  218. data/lib/logstash/outputs/mongodb.rb +81 -0
  219. data/lib/logstash/outputs/nagios.rb +119 -0
  220. data/lib/logstash/outputs/nagios_nsca.rb +123 -0
  221. data/lib/logstash/outputs/null.rb +18 -0
  222. data/lib/logstash/outputs/opentsdb.rb +101 -0
  223. data/lib/logstash/outputs/pagerduty.rb +79 -0
  224. data/lib/logstash/outputs/pipe.rb +132 -0
  225. data/lib/logstash/outputs/rabbitmq.rb +96 -0
  226. data/lib/logstash/outputs/rabbitmq/bunny.rb +135 -0
  227. data/lib/logstash/outputs/rabbitmq/hot_bunnies.rb +1 -0
  228. data/lib/logstash/outputs/rabbitmq/march_hare.rb +143 -0
  229. data/lib/logstash/outputs/redis.rb +245 -0
  230. data/lib/logstash/outputs/riak.rb +152 -0
  231. data/lib/logstash/outputs/riemann.rb +109 -0
  232. data/lib/logstash/outputs/s3.rb +356 -0
  233. data/lib/logstash/outputs/sns.rb +124 -0
  234. data/lib/logstash/outputs/solr_http.rb +78 -0
  235. data/lib/logstash/outputs/sqs.rb +141 -0
  236. data/lib/logstash/outputs/statsd.rb +116 -0
  237. data/lib/logstash/outputs/stdout.rb +53 -0
  238. data/lib/logstash/outputs/stomp.rb +67 -0
  239. data/lib/logstash/outputs/syslog.rb +145 -0
  240. data/lib/logstash/outputs/tcp.rb +145 -0
  241. data/lib/logstash/outputs/udp.rb +38 -0
  242. data/lib/logstash/outputs/websocket.rb +46 -0
  243. data/lib/logstash/outputs/websocket/app.rb +29 -0
  244. data/lib/logstash/outputs/websocket/pubsub.rb +45 -0
  245. data/lib/logstash/outputs/xmpp.rb +78 -0
  246. data/lib/logstash/outputs/zabbix.rb +108 -0
  247. data/lib/logstash/outputs/zeromq.rb +125 -0
  248. data/lib/logstash/pipeline.rb +286 -0
  249. data/lib/logstash/plugin.rb +150 -0
  250. data/lib/logstash/plugin_mixins/aws_config.rb +93 -0
  251. data/lib/logstash/program.rb +15 -0
  252. data/lib/logstash/runner.rb +238 -0
  253. data/lib/logstash/sized_queue.rb +8 -0
  254. data/lib/logstash/test.rb +183 -0
  255. data/lib/logstash/threadwatchdog.rb +37 -0
  256. data/lib/logstash/time_addon.rb +33 -0
  257. data/lib/logstash/util.rb +106 -0
  258. data/lib/logstash/util/buftok.rb +139 -0
  259. data/lib/logstash/util/charset.rb +39 -0
  260. data/lib/logstash/util/fieldreference.rb +50 -0
  261. data/lib/logstash/util/password.rb +25 -0
  262. data/lib/logstash/util/prctl.rb +11 -0
  263. data/lib/logstash/util/relp.rb +326 -0
  264. data/lib/logstash/util/require-helper.rb +18 -0
  265. data/lib/logstash/util/socket_peer.rb +7 -0
  266. data/lib/logstash/util/zenoss.rb +566 -0
  267. data/lib/logstash/util/zeromq.rb +47 -0
  268. data/lib/logstash/version.rb +6 -0
  269. data/locales/en.yml +170 -0
  270. data/logstash-event.gemspec +29 -0
  271. data/logstash.gemspec +128 -0
  272. data/patterns/firewalls +60 -0
  273. data/patterns/grok-patterns +91 -0
  274. data/patterns/haproxy +37 -0
  275. data/patterns/java +3 -0
  276. data/patterns/linux-syslog +14 -0
  277. data/patterns/mcollective +1 -0
  278. data/patterns/mcollective-patterns +4 -0
  279. data/patterns/nagios +108 -0
  280. data/patterns/postgresql +3 -0
  281. data/patterns/redis +3 -0
  282. data/patterns/ruby +2 -0
  283. data/pkg/build.sh +135 -0
  284. data/pkg/centos/after-install.sh +1 -0
  285. data/pkg/centos/before-install.sh +10 -0
  286. data/pkg/centos/before-remove.sh +11 -0
  287. data/pkg/centos/sysconfig +15 -0
  288. data/pkg/debian/after-install.sh +5 -0
  289. data/pkg/debian/before-install.sh +13 -0
  290. data/pkg/debian/before-remove.sh +13 -0
  291. data/pkg/debian/build.sh +34 -0
  292. data/pkg/debian/debian/README +6 -0
  293. data/pkg/debian/debian/changelog +17 -0
  294. data/pkg/debian/debian/compat +1 -0
  295. data/pkg/debian/debian/control +16 -0
  296. data/pkg/debian/debian/copyright +27 -0
  297. data/pkg/debian/debian/dirs +19 -0
  298. data/pkg/debian/debian/docs +0 -0
  299. data/pkg/debian/debian/logstash.default +39 -0
  300. data/pkg/debian/debian/logstash.init +201 -0
  301. data/pkg/debian/debian/logstash.install +1 -0
  302. data/pkg/debian/debian/logstash.logrotate +9 -0
  303. data/pkg/debian/debian/logstash.postinst +68 -0
  304. data/pkg/debian/debian/logstash.postrm +23 -0
  305. data/pkg/debian/debian/manpage.1.ex +59 -0
  306. data/pkg/debian/debian/preinst.ex +37 -0
  307. data/pkg/debian/debian/prerm.ex +40 -0
  308. data/pkg/debian/debian/release.conf +5 -0
  309. data/pkg/debian/debian/rules +80 -0
  310. data/pkg/debian/debian/watch.ex +22 -0
  311. data/pkg/logrotate.conf +8 -0
  312. data/pkg/logstash-web.default +41 -0
  313. data/pkg/logstash-web.sysv.debian +201 -0
  314. data/pkg/logstash-web.upstart.ubuntu +18 -0
  315. data/pkg/logstash.default +45 -0
  316. data/pkg/logstash.sysv.debian +202 -0
  317. data/pkg/logstash.sysv.redhat +158 -0
  318. data/pkg/logstash.upstart.ubuntu +20 -0
  319. data/pkg/rpm/SOURCES/logstash.conf +26 -0
  320. data/pkg/rpm/SOURCES/logstash.init +80 -0
  321. data/pkg/rpm/SOURCES/logstash.logrotate +8 -0
  322. data/pkg/rpm/SOURCES/logstash.sysconfig +3 -0
  323. data/pkg/rpm/SOURCES/logstash.wrapper +105 -0
  324. data/pkg/rpm/SPECS/logstash.spec +180 -0
  325. data/pkg/rpm/readme.md +4 -0
  326. data/pkg/ubuntu/after-install.sh +7 -0
  327. data/pkg/ubuntu/before-install.sh +12 -0
  328. data/pkg/ubuntu/before-remove.sh +13 -0
  329. data/pull_release_note.rb +25 -0
  330. data/require-analyze.rb +22 -0
  331. data/spec/README.md +14 -0
  332. data/spec/codecs/edn.rb +40 -0
  333. data/spec/codecs/edn_lines.rb +53 -0
  334. data/spec/codecs/graphite.rb +96 -0
  335. data/spec/codecs/json.rb +57 -0
  336. data/spec/codecs/json_lines.rb +51 -0
  337. data/spec/codecs/json_spooler.rb +43 -0
  338. data/spec/codecs/msgpack.rb +39 -0
  339. data/spec/codecs/multiline.rb +60 -0
  340. data/spec/codecs/oldlogstashjson.rb +55 -0
  341. data/spec/codecs/plain.rb +35 -0
  342. data/spec/codecs/spool.rb +35 -0
  343. data/spec/conditionals/test.rb +323 -0
  344. data/spec/config.rb +31 -0
  345. data/spec/event.rb +165 -0
  346. data/spec/examples/fail2ban.rb +28 -0
  347. data/spec/examples/graphite-input.rb +41 -0
  348. data/spec/examples/mysql-slow-query.rb +70 -0
  349. data/spec/examples/parse-apache-logs.rb +66 -0
  350. data/spec/examples/parse-haproxy-logs.rb +115 -0
  351. data/spec/examples/syslog.rb +48 -0
  352. data/spec/filters/alter.rb +96 -0
  353. data/spec/filters/anonymize.rb +189 -0
  354. data/spec/filters/checksum.rb +41 -0
  355. data/spec/filters/clone.rb +67 -0
  356. data/spec/filters/collate.rb +122 -0
  357. data/spec/filters/csv.rb +174 -0
  358. data/spec/filters/date.rb +285 -0
  359. data/spec/filters/date_performance.rb +31 -0
  360. data/spec/filters/dns.rb +159 -0
  361. data/spec/filters/drop.rb +19 -0
  362. data/spec/filters/elapsed.rb +294 -0
  363. data/spec/filters/environment.rb +43 -0
  364. data/spec/filters/geoip.rb +62 -0
  365. data/spec/filters/grep.rb +342 -0
  366. data/spec/filters/grok.rb +473 -0
  367. data/spec/filters/grok/timeout2.rb +56 -0
  368. data/spec/filters/grok/timeouts.rb +39 -0
  369. data/spec/filters/i18n.rb +25 -0
  370. data/spec/filters/json.rb +72 -0
  371. data/spec/filters/json_encode.rb +37 -0
  372. data/spec/filters/kv.rb +403 -0
  373. data/spec/filters/metrics.rb +212 -0
  374. data/spec/filters/multiline.rb +119 -0
  375. data/spec/filters/mutate.rb +180 -0
  376. data/spec/filters/noop.rb +221 -0
  377. data/spec/filters/prune.rb +441 -0
  378. data/spec/filters/punct.rb +18 -0
  379. data/spec/filters/railsparallelrequest.rb +112 -0
  380. data/spec/filters/range.rb +169 -0
  381. data/spec/filters/split.rb +58 -0
  382. data/spec/filters/translate.rb +70 -0
  383. data/spec/filters/unique.rb +25 -0
  384. data/spec/filters/useragent.rb +42 -0
  385. data/spec/filters/xml.rb +157 -0
  386. data/spec/inputs/file.rb +107 -0
  387. data/spec/inputs/gelf.rb +52 -0
  388. data/spec/inputs/generator.rb +30 -0
  389. data/spec/inputs/imap.rb +60 -0
  390. data/spec/inputs/redis.rb +63 -0
  391. data/spec/inputs/relp.rb +70 -0
  392. data/spec/inputs/tcp.rb +101 -0
  393. data/spec/jar.rb +21 -0
  394. data/spec/outputs/csv.rb +266 -0
  395. data/spec/outputs/elasticsearch.rb +161 -0
  396. data/spec/outputs/elasticsearch_http.rb +240 -0
  397. data/spec/outputs/email.rb +173 -0
  398. data/spec/outputs/file.rb +82 -0
  399. data/spec/outputs/graphite.rb +236 -0
  400. data/spec/outputs/redis.rb +127 -0
  401. data/spec/speed.rb +20 -0
  402. data/spec/sqlite-test.rb +81 -0
  403. data/spec/support/LOGSTASH-733.rb +21 -0
  404. data/spec/support/LOGSTASH-820.rb +25 -0
  405. data/spec/support/akamai-grok.rb +26 -0
  406. data/spec/support/date-http.rb +17 -0
  407. data/spec/support/postwait1.rb +26 -0
  408. data/spec/support/pull375.rb +21 -0
  409. data/spec/test_utils.rb +125 -0
  410. data/spec/util/fieldeval_spec.rb +44 -0
  411. data/test/jenkins/config.xml.erb +74 -0
  412. data/test/jenkins/create-jobs.rb +23 -0
  413. data/test/jenkins/generatorjob.config.xml +66 -0
  414. data/tools/Gemfile +14 -0
  415. data/tools/Gemfile.jruby-1.9.lock +322 -0
  416. data/tools/Gemfile.rbx-2.1.lock +516 -0
  417. data/tools/Gemfile.ruby-1.9.1.lock +310 -0
  418. data/tools/Gemfile.ruby-2.0.0.lock +310 -0
  419. metadata +629 -0
@@ -0,0 +1,185 @@
1
+ # encoding: utf-8
2
+ require "logstash/outputs/base"
3
+ require "logstash/namespace"
4
+
5
+ # A plugin for a newly developed Java/Spring Metrics application
6
+ # I didn't really want to code this project but I couldn't find
7
+ # a respectable alternative that would also run on any Windows
8
+ # machine - which is the problem and why I am not going with Graphite
9
+ # and statsd. This application provides multiple integration options
10
+ # so as to make its use under your network requirements possible.
11
+ # This includes a REST option that is always enabled for your use
12
+ # in case you want to write a small script to send the occasional
13
+ # metric data.
14
+ #
15
+ # Find GraphTastic here : https://github.com/NickPadilla/GraphTastic
16
+ class LogStash::Outputs::GraphTastic < LogStash::Outputs::Base
17
+
18
+ config_name "graphtastic"
19
+ milestone 2
20
+
21
+ # options are udp(fastest - default) - rmi(faster) - rest(fast) - tcp(don't use TCP yet - some problems - errors out on linux)
22
+ config :integration, :validate => ["udp","tcp","rmi","rest"], :default => "udp"
23
+
24
+ # if using rest as your end point you need to also provide the application url
25
+ # it defaults to localhost/graphtastic. You can customize the application url
26
+ # by changing the name of the .war file. There are other ways to change the
27
+ # application context, but they vary depending on the Application Server in use.
28
+ # Please consult your application server documentation for more on application
29
+ # contexts.
30
+ config :context, :validate => :string, :default => "graphtastic"
31
+
32
+ # metrics hash - you will provide a name for your metric and the metric
33
+ # data as key value pairs. so for example:
34
+ #
35
+ # metrics => { "Response" => "%{response}" }
36
+ #
37
+ # example for the logstash config
38
+ #
39
+ # metrics => [ "Response", "%{response}" ]
40
+ #
41
+ # NOTE: you can also use the dynamic fields for the key value as well as the actual value
42
+ config :metrics, :validate => :hash, :default => {}
43
+
44
+ # host for the graphtastic server - defaults to 127.0.0.1
45
+ config :host, :validate => :string, :default => "127.0.0.1"
46
+
47
+ # port for the graphtastic instance - defaults to 1199 for RMI, 1299 for TCP, 1399 for UDP, and 8080 for REST
48
+ config :port, :validate => :number
49
+
50
+ # number of attempted retry after send error - currently only way to integrate
51
+ # errored transactions - should try and save to a file or later consumption
52
+ # either by graphtastic utility or by this program after connectivity is
53
+ # ensured to be established.
54
+ config :retries, :validate => :number, :default => 1
55
+
56
+ # the number of metrics to send to GraphTastic at one time. 60 seems to be the perfect
57
+ # amount for UDP, with default packet size.
58
+ config :batch_number, :validate => :number, :default => 60
59
+
60
+ # setting allows you to specify where we save errored transactions
61
+ # this makes the most sense at this point - will need to decide
62
+ # on how we reintegrate these error metrics
63
+ # NOT IMPLEMENTED!
64
+ config :error_file, :validate => :string, :default => ""
65
+
66
+ public
67
+ def register
68
+ @batch = []
69
+ begin
70
+ if @integration.downcase == "rmi"
71
+ if RUBY_ENGINE != "jruby"
72
+ raise Exception.new("LogStash::Outputs::GraphTastic# JRuby is needed for RMI to work!")
73
+ end
74
+ require "java"
75
+ if @port.nil?
76
+ @port = 1199
77
+ end
78
+ registry = java.rmi.registry.LocateRegistry.getRegistry(@host, @port);
79
+ @remote = registry.lookup("RmiMetricService")
80
+ elsif @integration.downcase == "rest"
81
+ require "net/http"
82
+ if @port.nil?
83
+ @port = 8080
84
+ gem "mail" #outputs/email, # License: MIT License
85
+ end
86
+ @http = Net::HTTP.new(@host, @port)
87
+ end
88
+ @logger.info("GraphTastic Output Successfully Registered! Using #{@integration} Integration!")
89
+ rescue
90
+ @logger.error("*******ERROR : #{$!}")
91
+ end
92
+ end
93
+
94
+ public
95
+ def receive(event)
96
+ return unless output?(event)
97
+ # Set Intersection - returns a new array with the items that are the same between the two
98
+ if !@tags.empty? && (event["tags"] & @tags).size == 0
99
+ # Skip events that have no tags in common with what we were configured
100
+ @logger.debug("No Tags match for GraphTastic Output!")
101
+ return
102
+ end
103
+ @retry = 1
104
+ @logger.debug("Event found for GraphTastic!", :tags => @tags, :event => event)
105
+ @metrics.each do |name, metric|
106
+ postMetric(event.sprintf(name),event.sprintf(metric),(event["@timestamp"]*1000))# unix_timestamp is what I need in seconds - multiply by 1000 to make milliseconds.
107
+ end
108
+ end
109
+
110
+ def postMetric(name, metric, timestamp)
111
+ message = name+","+metric+","+timestamp.to_s
112
+ if @batch.length < @batch_number
113
+ @batch.push(message)
114
+ else
115
+ flushMetrics()
116
+ end
117
+ end
118
+
119
+ def flushMetrics()
120
+ begin
121
+ if @integration.downcase == "tcp"
122
+ flushViaTCP()
123
+ elsif @integration.downcase == "rmi"
124
+ flushViaRMI()
125
+ elsif @integration.downcase == "udp"
126
+ flushViaUDP()
127
+ elsif @integration.downcase == "rest"
128
+ flushViaREST()
129
+ else
130
+ @logger.error("GraphTastic Not Able To Find Correct Integration - Nothing Sent - Integration Type : ", :@integration => @integration)
131
+ end
132
+ @batch.clear
133
+ rescue
134
+ @logger.error("*******ERROR : #{$!}")
135
+ @logger.info("*******Attempting #{@retry} out of #{@retries}")
136
+ while @retry < @retries
137
+ @retry = @retry + 1
138
+ flushMetrics()
139
+ end
140
+ end
141
+ end
142
+
143
+ # send metrics via udp
144
+ def flushViaUDP()
145
+ if @port.nil?
146
+ @port = 1399
147
+ end
148
+ udpsocket.send(@batch.join(','), 0, @host, @port)
149
+ @logger.debug("GraphTastic Sent Message Using UDP : #{@batch.join(',')}")
150
+ end
151
+
152
+ # send metrics via REST
153
+ def flushViaREST()
154
+ request = Net::HTTP::Put.new("/#{@context}/addMetric/#{@batch.join(',')}")
155
+ response = @http.request(request)
156
+ if response == 'ERROR'
157
+ raise 'Error happend when sending metric to GraphTastic using REST!'
158
+ end
159
+ @logger.debug("GraphTastic Sent Message Using REST : #{@batch.join(',')}", :response => response.inspect)
160
+ end
161
+
162
+ # send metrics via RMI
163
+ def flushViaRMI()
164
+ if RUBY_ENGINE != "jruby"
165
+ raise Exception.new("LogStash::Outputs::GraphTastic# JRuby is needed for RMI to work!")
166
+ end
167
+ @remote.insertMetrics(@batch.join(','))
168
+ @logger.debug("GraphTastic Sent Message Using RMI : #{@batch.join(',')}")
169
+ end
170
+
171
+ # send metrics via tcp
172
+ def flushViaTCP()
173
+ # to correctly read the line we need to ensure we send \r\n at the end of every message.
174
+ if @port.nil?
175
+ @port = 1299
176
+ end
177
+ tcpsocket = TCPSocket.open(@host, @port)
178
+ tcpsocket.send(@batch.join(',')+"\r\n", 0)
179
+ tcpsocket.close
180
+ @logger.debug("GraphTastic Sent Message Using TCP : #{@batch.join(',')}")
181
+ end
182
+
183
+ def udpsocket; @socket ||= UDPSocket.new end
184
+
185
+ end
@@ -0,0 +1,80 @@
1
+ # encoding: utf-8
2
+ require "logstash/namespace"
3
+ require "logstash/outputs/http"
4
+
5
+ # This output allows you to write events to [HipChat](https://www.hipchat.com/).
6
+ #
7
+ class LogStash::Outputs::HipChat < LogStash::Outputs::Base
8
+
9
+ config_name "hipchat"
10
+ milestone 1
11
+
12
+ # The HipChat authentication token.
13
+ config :token, :validate => :string, :required => true
14
+
15
+ # The ID or name of the room.
16
+ config :room_id, :validate => :string, :required => true
17
+
18
+ # The name the message will appear be sent from.
19
+ config :from, :validate => :string, :default => "logstash"
20
+
21
+ # Whether or not this message should trigger a notification for people in the room.
22
+ config :trigger_notify, :validate => :boolean, :default => false
23
+
24
+ # Background color for message.
25
+ # HipChat currently supports one of "yellow", "red", "green", "purple",
26
+ # "gray", or "random". (default: yellow)
27
+ config :color, :validate => :string, :default => "yellow"
28
+
29
+ # Message format to send, event tokens are usable here.
30
+ config :format, :validate => :string, :default => "%{message}"
31
+
32
+ public
33
+ def register
34
+ require "ftw"
35
+ require "uri"
36
+
37
+ @agent = FTW::Agent.new
38
+
39
+ @url = "https://api.hipchat.com/v1/rooms/message?auth_token=" + @token
40
+ @content_type = "application/x-www-form-urlencoded"
41
+ end # def register
42
+
43
+ public
44
+ def receive(event)
45
+ return unless output?(event)
46
+
47
+ hipchat_data = Hash.new
48
+ hipchat_data['room_id'] = @room_id
49
+ hipchat_data['from'] = @from
50
+ hipchat_data['color'] = @color
51
+ hipchat_data['notify'] = @trigger_notify ? "1" : "0"
52
+ hipchat_data['message'] = event.sprintf(@format)
53
+
54
+ @logger.debug("HipChat data", :hipchat_data => hipchat_data)
55
+
56
+ begin
57
+ request = @agent.post(@url)
58
+ request["Content-Type"] = @content_type
59
+ request.body = encode(hipchat_data)
60
+
61
+ response = @agent.execute(request)
62
+
63
+ # Consume body to let this connection be reused
64
+ rbody = ""
65
+ response.read_body { |c| rbody << c }
66
+ #puts rbody
67
+ rescue Exception => e
68
+ @logger.warn("Unhandled exception", :request => request, :response => response, :exception => e, :stacktrace => e.backtrace)
69
+ end
70
+ end # def receive
71
+
72
+ # shamelessly lifted this from the LogStash::Outputs::Http, I'd rather put this
73
+ # in a common place for both to use, but unsure where that place is or should be
74
+ def encode(hash)
75
+ return hash.collect do |key, value|
76
+ CGI.escape(key) + "=" + CGI.escape(value)
77
+ end.join("&")
78
+ end # def encode
79
+
80
+ end # class LogStash::Outputs::HipChat
@@ -0,0 +1,142 @@
1
+ # encoding: utf-8
2
+ require "logstash/outputs/base"
3
+ require "logstash/namespace"
4
+
5
+ class LogStash::Outputs::Http < LogStash::Outputs::Base
6
+ # This output lets you `PUT` or `POST` events to a
7
+ # generic HTTP(S) endpoint
8
+ #
9
+ # Additionally, you are given the option to customize
10
+ # the headers sent as well as basic customization of the
11
+ # event json itself.
12
+
13
+ config_name "http"
14
+ milestone 1
15
+
16
+ # URL to use
17
+ config :url, :validate => :string, :required => :true
18
+
19
+ # validate SSL?
20
+ config :verify_ssl, :validate => :boolean, :default => true
21
+
22
+ # What verb to use
23
+ # only put and post are supported for now
24
+ config :http_method, :validate => ["put", "post"], :required => :true
25
+
26
+ # Custom headers to use
27
+ # format is `headers => ["X-My-Header", "%{host}"]
28
+ config :headers, :validate => :hash
29
+
30
+ # Content type
31
+ #
32
+ # If not specified, this defaults to the following:
33
+ #
34
+ # * if format is "json", "application/json"
35
+ # * if format is "form", "application/x-www-form-urlencoded"
36
+ config :content_type, :validate => :string
37
+
38
+ # This lets you choose the structure and parts of the event that are sent.
39
+ #
40
+ #
41
+ # For example:
42
+ #
43
+ # mapping => ["foo", "%{host}", "bar", "%{type}"]
44
+ config :mapping, :validate => :hash
45
+
46
+ # Set the format of the http body.
47
+ #
48
+ # If form, then the body will be the mapping (or whole event) converted
49
+ # into a query parameter string (foo=bar&baz=fizz...)
50
+ #
51
+ # If message, then the body will be the result of formatting the event according to message
52
+ #
53
+ # Otherwise, the event is sent as json.
54
+ config :format, :validate => ["json", "form", "message"], :default => "json"
55
+
56
+ config :message, :validate => :string
57
+
58
+ public
59
+ def register
60
+ require "ftw"
61
+ require "uri"
62
+ @agent = FTW::Agent.new
63
+ # TODO(sissel): SSL verify mode?
64
+
65
+ if @content_type.nil?
66
+ case @format
67
+ when "form" ; @content_type = "application/x-www-form-urlencoded"
68
+ when "json" ; @content_type = "application/json"
69
+ end
70
+ end
71
+ if @format == "message"
72
+ if @message.nil?
73
+ raise "message must be set if message format is used"
74
+ end
75
+ if @content_type.nil?
76
+ raise "content_type must be set if message format is used"
77
+ end
78
+ unless @mapping.nil?
79
+ @logger.warn "mapping is not supported and will be ignored if message format is used"
80
+ end
81
+ end
82
+ end # def register
83
+
84
+ public
85
+ def receive(event)
86
+ return unless output?(event)
87
+
88
+ if @mapping
89
+ evt = Hash.new
90
+ @mapping.each do |k,v|
91
+ evt[k] = event.sprintf(v)
92
+ end
93
+ else
94
+ evt = event.to_hash
95
+ end
96
+
97
+ case @http_method
98
+ when "put"
99
+ request = @agent.put(event.sprintf(@url))
100
+ when "post"
101
+ request = @agent.post(event.sprintf(@url))
102
+ else
103
+ @logger.error("Unknown verb:", :verb => @http_method)
104
+ end
105
+
106
+ if @headers
107
+ @headers.each do |k,v|
108
+ request.headers[k] = event.sprintf(v)
109
+ end
110
+ end
111
+
112
+ request["Content-Type"] = @content_type
113
+
114
+ begin
115
+ if @format == "json"
116
+ request.body = evt.to_json
117
+ elsif @format == "message"
118
+ request.body = event.sprintf(@message)
119
+ else
120
+ request.body = encode(evt)
121
+ end
122
+ #puts "#{request.port} / #{request.protocol}"
123
+ #puts request
124
+ #puts
125
+ #puts request.body
126
+ response = @agent.execute(request)
127
+
128
+ # Consume body to let this connection be reused
129
+ rbody = ""
130
+ response.read_body { |c| rbody << c }
131
+ #puts rbody
132
+ rescue Exception => e
133
+ @logger.warn("Unhandled exception", :request => request, :response => response, :exception => e, :stacktrace => e.backtrace)
134
+ end
135
+ end # def receive
136
+
137
+ def encode(hash)
138
+ return hash.collect do |key, value|
139
+ CGI.escape(key) + "=" + CGI.escape(value)
140
+ end.join("&")
141
+ end # def encode
142
+ end
@@ -0,0 +1,80 @@
1
+ # encoding: utf-8
2
+ require "logstash/outputs/base"
3
+ require "logstash/namespace"
4
+ require "thread"
5
+
6
+ # Write events to IRC
7
+ #
8
+ class LogStash::Outputs::Irc < LogStash::Outputs::Base
9
+
10
+ config_name "irc"
11
+ milestone 1
12
+
13
+ # Address of the host to connect to
14
+ config :host, :validate => :string, :required => true
15
+
16
+ # Port on host to connect to.
17
+ config :port, :validate => :number, :default => 6667
18
+
19
+ # IRC Nickname
20
+ config :nick, :validate => :string, :default => "logstash"
21
+
22
+ # IRC Username
23
+ config :user, :validate => :string, :default => "logstash"
24
+
25
+ # IRC Real name
26
+ config :real, :validate => :string, :default => "logstash"
27
+
28
+ # IRC server password
29
+ config :password, :validate => :password
30
+
31
+ # Channels to broadcast to.
32
+ #
33
+ # These should be full channel names including the '#' symbol, such as
34
+ # "#logstash".
35
+ config :channels, :validate => :array, :required => true
36
+
37
+ # Message format to send, event tokens are usable here
38
+ config :format, :validate => :string, :default => "%{message}"
39
+
40
+ # Set this to true to enable SSL.
41
+ config :secure, :validate => :boolean, :default => false
42
+
43
+ # Limit the rate of messages sent to IRC in messages per second.
44
+ config :messages_per_second, :validate => :number, :default => 0.5
45
+
46
+ public
47
+ def register
48
+ require "cinch"
49
+ @irc_queue = Queue.new
50
+ @logger.info("Connecting to irc server", :host => @host, :port => @port, :nick => @nick, :channels => @channels)
51
+
52
+ @bot = Cinch::Bot.new
53
+ @bot.loggers.clear
54
+ @bot.configure do |c|
55
+ c.server = @host
56
+ c.port = @port
57
+ c.nick = @nick
58
+ c.user = @user
59
+ c.realname = @real
60
+ c.channels = @channels
61
+ c.password = @password.value rescue nil
62
+ c.ssl.use = @secure
63
+ c.messages_per_second = @messages_per_second if @messages_per_second
64
+ end
65
+ Thread.new(@bot) do |bot|
66
+ bot.start
67
+ end
68
+ end # def register
69
+
70
+ public
71
+ def receive(event)
72
+ return unless output?(event)
73
+ @logger.debug("Sending message to channels", :event => event)
74
+ text = event.sprintf(@format)
75
+ @bot.channels.each do |channel|
76
+ @logger.debug("Sending to...", :channel => channel, :text => text)
77
+ channel.msg(text)
78
+ end # channels.each
79
+ end # def receive
80
+ end # class LogStash::Outputs::Irc