logstash-lib 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +24 -0
- data/.tailor +8 -0
- data/.travis.yml +12 -0
- data/CHANGELOG +1185 -0
- data/CONTRIBUTING.md +61 -0
- data/CONTRIBUTORS +79 -0
- data/LICENSE +14 -0
- data/Makefile +460 -0
- data/README.md +120 -0
- data/STYLE.md +96 -0
- data/bin/logstash +37 -0
- data/bin/logstash-test +4 -0
- data/bin/logstash-web +4 -0
- data/bin/logstash.lib.sh +78 -0
- data/bot/check_pull_changelog.rb +89 -0
- data/docs/configuration.md +260 -0
- data/docs/docgen.rb +242 -0
- data/docs/extending/example-add-a-new-filter.md +121 -0
- data/docs/extending/index.md +91 -0
- data/docs/flags.md +43 -0
- data/docs/generate_index.rb +28 -0
- data/docs/index.html.erb +56 -0
- data/docs/learn.md +46 -0
- data/docs/life-of-an-event.md +109 -0
- data/docs/logging-tool-comparisons.md +60 -0
- data/docs/plugin-doc.html.erb +91 -0
- data/docs/plugin-milestones.md +41 -0
- data/docs/plugin-synopsis.html.erb +24 -0
- data/docs/release-engineering.md +46 -0
- data/docs/release-test-results.md +14 -0
- data/docs/repositories.md +35 -0
- data/docs/tutorials/10-minute-walkthrough/apache-elasticsearch.conf +35 -0
- data/docs/tutorials/10-minute-walkthrough/apache-parse.conf +33 -0
- data/docs/tutorials/10-minute-walkthrough/apache_log.1 +1 -0
- data/docs/tutorials/10-minute-walkthrough/apache_log.2.bz2 +0 -0
- data/docs/tutorials/10-minute-walkthrough/hello-search.conf +25 -0
- data/docs/tutorials/10-minute-walkthrough/hello.conf +16 -0
- data/docs/tutorials/10-minute-walkthrough/index.md +124 -0
- data/docs/tutorials/10-minute-walkthrough/step-5-output.txt +17 -0
- data/docs/tutorials/getting-started-centralized-overview-diagram.png +0 -0
- data/docs/tutorials/getting-started-centralized-overview-diagram.xml +1 -0
- data/docs/tutorials/getting-started-centralized.md +217 -0
- data/docs/tutorials/getting-started-simple.md +200 -0
- data/docs/tutorials/just-enough-rabbitmq-for-logstash.md +201 -0
- data/docs/tutorials/media/frontend-response-codes.png +0 -0
- data/docs/tutorials/metrics-from-logs.md +84 -0
- data/docs/tutorials/zeromq.md +118 -0
- data/extract_services.rb +29 -0
- data/gembag.rb +64 -0
- data/lib/logstash-event.rb +2 -0
- data/lib/logstash.rb +4 -0
- data/lib/logstash/JRUBY-6970-openssl.rb +22 -0
- data/lib/logstash/JRUBY-6970.rb +102 -0
- data/lib/logstash/agent.rb +305 -0
- data/lib/logstash/certs/cacert.pem +3895 -0
- data/lib/logstash/codecs/base.rb +49 -0
- data/lib/logstash/codecs/compress_spooler.rb +50 -0
- data/lib/logstash/codecs/dots.rb +18 -0
- data/lib/logstash/codecs/edn.rb +28 -0
- data/lib/logstash/codecs/edn_lines.rb +36 -0
- data/lib/logstash/codecs/fluent.rb +55 -0
- data/lib/logstash/codecs/graphite.rb +114 -0
- data/lib/logstash/codecs/json.rb +41 -0
- data/lib/logstash/codecs/json_lines.rb +52 -0
- data/lib/logstash/codecs/json_spooler.rb +22 -0
- data/lib/logstash/codecs/line.rb +58 -0
- data/lib/logstash/codecs/msgpack.rb +43 -0
- data/lib/logstash/codecs/multiline.rb +189 -0
- data/lib/logstash/codecs/netflow.rb +342 -0
- data/lib/logstash/codecs/netflow/util.rb +212 -0
- data/lib/logstash/codecs/noop.rb +19 -0
- data/lib/logstash/codecs/oldlogstashjson.rb +56 -0
- data/lib/logstash/codecs/plain.rb +48 -0
- data/lib/logstash/codecs/rubydebug.rb +22 -0
- data/lib/logstash/codecs/spool.rb +38 -0
- data/lib/logstash/config/Makefile +4 -0
- data/lib/logstash/config/config_ast.rb +380 -0
- data/lib/logstash/config/file.rb +39 -0
- data/lib/logstash/config/grammar.rb +3504 -0
- data/lib/logstash/config/grammar.treetop +241 -0
- data/lib/logstash/config/mixin.rb +464 -0
- data/lib/logstash/config/registry.rb +13 -0
- data/lib/logstash/config/test.conf +18 -0
- data/lib/logstash/errors.rb +10 -0
- data/lib/logstash/event.rb +262 -0
- data/lib/logstash/filters/advisor.rb +178 -0
- data/lib/logstash/filters/alter.rb +173 -0
- data/lib/logstash/filters/anonymize.rb +93 -0
- data/lib/logstash/filters/base.rb +190 -0
- data/lib/logstash/filters/checksum.rb +50 -0
- data/lib/logstash/filters/cidr.rb +76 -0
- data/lib/logstash/filters/cipher.rb +145 -0
- data/lib/logstash/filters/clone.rb +35 -0
- data/lib/logstash/filters/collate.rb +114 -0
- data/lib/logstash/filters/csv.rb +94 -0
- data/lib/logstash/filters/date.rb +244 -0
- data/lib/logstash/filters/dns.rb +201 -0
- data/lib/logstash/filters/drop.rb +32 -0
- data/lib/logstash/filters/elapsed.rb +256 -0
- data/lib/logstash/filters/elasticsearch.rb +73 -0
- data/lib/logstash/filters/environment.rb +27 -0
- data/lib/logstash/filters/extractnumbers.rb +84 -0
- data/lib/logstash/filters/gelfify.rb +52 -0
- data/lib/logstash/filters/geoip.rb +145 -0
- data/lib/logstash/filters/grep.rb +153 -0
- data/lib/logstash/filters/grok.rb +425 -0
- data/lib/logstash/filters/grokdiscovery.rb +75 -0
- data/lib/logstash/filters/i18n.rb +51 -0
- data/lib/logstash/filters/json.rb +90 -0
- data/lib/logstash/filters/json_encode.rb +52 -0
- data/lib/logstash/filters/kv.rb +232 -0
- data/lib/logstash/filters/metaevent.rb +68 -0
- data/lib/logstash/filters/metrics.rb +237 -0
- data/lib/logstash/filters/multiline.rb +241 -0
- data/lib/logstash/filters/mutate.rb +399 -0
- data/lib/logstash/filters/noop.rb +21 -0
- data/lib/logstash/filters/prune.rb +149 -0
- data/lib/logstash/filters/punct.rb +32 -0
- data/lib/logstash/filters/railsparallelrequest.rb +86 -0
- data/lib/logstash/filters/range.rb +142 -0
- data/lib/logstash/filters/ruby.rb +42 -0
- data/lib/logstash/filters/sleep.rb +111 -0
- data/lib/logstash/filters/split.rb +64 -0
- data/lib/logstash/filters/sumnumbers.rb +73 -0
- data/lib/logstash/filters/syslog_pri.rb +107 -0
- data/lib/logstash/filters/translate.rb +121 -0
- data/lib/logstash/filters/unique.rb +29 -0
- data/lib/logstash/filters/urldecode.rb +57 -0
- data/lib/logstash/filters/useragent.rb +112 -0
- data/lib/logstash/filters/uuid.rb +58 -0
- data/lib/logstash/filters/xml.rb +139 -0
- data/lib/logstash/filters/zeromq.rb +123 -0
- data/lib/logstash/filterworker.rb +122 -0
- data/lib/logstash/inputs/base.rb +125 -0
- data/lib/logstash/inputs/collectd.rb +306 -0
- data/lib/logstash/inputs/drupal_dblog.rb +323 -0
- data/lib/logstash/inputs/drupal_dblog/jdbcconnection.rb +66 -0
- data/lib/logstash/inputs/elasticsearch.rb +140 -0
- data/lib/logstash/inputs/eventlog.rb +129 -0
- data/lib/logstash/inputs/eventlog/racob_fix.rb +44 -0
- data/lib/logstash/inputs/exec.rb +69 -0
- data/lib/logstash/inputs/file.rb +146 -0
- data/lib/logstash/inputs/ganglia.rb +127 -0
- data/lib/logstash/inputs/ganglia/gmondpacket.rb +146 -0
- data/lib/logstash/inputs/ganglia/xdr.rb +327 -0
- data/lib/logstash/inputs/gelf.rb +138 -0
- data/lib/logstash/inputs/gemfire.rb +222 -0
- data/lib/logstash/inputs/generator.rb +97 -0
- data/lib/logstash/inputs/graphite.rb +41 -0
- data/lib/logstash/inputs/heroku.rb +51 -0
- data/lib/logstash/inputs/imap.rb +136 -0
- data/lib/logstash/inputs/irc.rb +84 -0
- data/lib/logstash/inputs/log4j.rb +136 -0
- data/lib/logstash/inputs/lumberjack.rb +53 -0
- data/lib/logstash/inputs/pipe.rb +57 -0
- data/lib/logstash/inputs/rabbitmq.rb +126 -0
- data/lib/logstash/inputs/rabbitmq/bunny.rb +118 -0
- data/lib/logstash/inputs/rabbitmq/hot_bunnies.rb +1 -0
- data/lib/logstash/inputs/rabbitmq/march_hare.rb +129 -0
- data/lib/logstash/inputs/redis.rb +263 -0
- data/lib/logstash/inputs/relp.rb +106 -0
- data/lib/logstash/inputs/s3.rb +279 -0
- data/lib/logstash/inputs/snmptrap.rb +87 -0
- data/lib/logstash/inputs/sqlite.rb +185 -0
- data/lib/logstash/inputs/sqs.rb +172 -0
- data/lib/logstash/inputs/stdin.rb +46 -0
- data/lib/logstash/inputs/stomp.rb +84 -0
- data/lib/logstash/inputs/syslog.rb +237 -0
- data/lib/logstash/inputs/tcp.rb +231 -0
- data/lib/logstash/inputs/threadable.rb +18 -0
- data/lib/logstash/inputs/twitter.rb +82 -0
- data/lib/logstash/inputs/udp.rb +81 -0
- data/lib/logstash/inputs/unix.rb +163 -0
- data/lib/logstash/inputs/varnishlog.rb +48 -0
- data/lib/logstash/inputs/websocket.rb +50 -0
- data/lib/logstash/inputs/wmi.rb +72 -0
- data/lib/logstash/inputs/xmpp.rb +81 -0
- data/lib/logstash/inputs/zenoss.rb +143 -0
- data/lib/logstash/inputs/zeromq.rb +165 -0
- data/lib/logstash/kibana.rb +113 -0
- data/lib/logstash/loadlibs.rb +9 -0
- data/lib/logstash/logging.rb +89 -0
- data/lib/logstash/monkeypatches-for-bugs.rb +2 -0
- data/lib/logstash/monkeypatches-for-debugging.rb +47 -0
- data/lib/logstash/monkeypatches-for-performance.rb +66 -0
- data/lib/logstash/multiqueue.rb +53 -0
- data/lib/logstash/namespace.rb +16 -0
- data/lib/logstash/outputs/base.rb +120 -0
- data/lib/logstash/outputs/boundary.rb +116 -0
- data/lib/logstash/outputs/circonus.rb +78 -0
- data/lib/logstash/outputs/cloudwatch.rb +351 -0
- data/lib/logstash/outputs/csv.rb +55 -0
- data/lib/logstash/outputs/datadog.rb +93 -0
- data/lib/logstash/outputs/datadog_metrics.rb +123 -0
- data/lib/logstash/outputs/elasticsearch.rb +332 -0
- data/lib/logstash/outputs/elasticsearch/elasticsearch-template.json +44 -0
- data/lib/logstash/outputs/elasticsearch_http.rb +256 -0
- data/lib/logstash/outputs/elasticsearch_river.rb +214 -0
- data/lib/logstash/outputs/email.rb +299 -0
- data/lib/logstash/outputs/exec.rb +40 -0
- data/lib/logstash/outputs/file.rb +180 -0
- data/lib/logstash/outputs/ganglia.rb +75 -0
- data/lib/logstash/outputs/gelf.rb +208 -0
- data/lib/logstash/outputs/gemfire.rb +103 -0
- data/lib/logstash/outputs/google_bigquery.rb +570 -0
- data/lib/logstash/outputs/google_cloud_storage.rb +431 -0
- data/lib/logstash/outputs/graphite.rb +143 -0
- data/lib/logstash/outputs/graphtastic.rb +185 -0
- data/lib/logstash/outputs/hipchat.rb +80 -0
- data/lib/logstash/outputs/http.rb +142 -0
- data/lib/logstash/outputs/irc.rb +80 -0
- data/lib/logstash/outputs/jira.rb +109 -0
- data/lib/logstash/outputs/juggernaut.rb +105 -0
- data/lib/logstash/outputs/librato.rb +146 -0
- data/lib/logstash/outputs/loggly.rb +93 -0
- data/lib/logstash/outputs/lumberjack.rb +51 -0
- data/lib/logstash/outputs/metriccatcher.rb +103 -0
- data/lib/logstash/outputs/mongodb.rb +81 -0
- data/lib/logstash/outputs/nagios.rb +119 -0
- data/lib/logstash/outputs/nagios_nsca.rb +123 -0
- data/lib/logstash/outputs/null.rb +18 -0
- data/lib/logstash/outputs/opentsdb.rb +101 -0
- data/lib/logstash/outputs/pagerduty.rb +79 -0
- data/lib/logstash/outputs/pipe.rb +132 -0
- data/lib/logstash/outputs/rabbitmq.rb +96 -0
- data/lib/logstash/outputs/rabbitmq/bunny.rb +135 -0
- data/lib/logstash/outputs/rabbitmq/hot_bunnies.rb +1 -0
- data/lib/logstash/outputs/rabbitmq/march_hare.rb +143 -0
- data/lib/logstash/outputs/redis.rb +245 -0
- data/lib/logstash/outputs/riak.rb +152 -0
- data/lib/logstash/outputs/riemann.rb +109 -0
- data/lib/logstash/outputs/s3.rb +356 -0
- data/lib/logstash/outputs/sns.rb +124 -0
- data/lib/logstash/outputs/solr_http.rb +78 -0
- data/lib/logstash/outputs/sqs.rb +141 -0
- data/lib/logstash/outputs/statsd.rb +116 -0
- data/lib/logstash/outputs/stdout.rb +53 -0
- data/lib/logstash/outputs/stomp.rb +67 -0
- data/lib/logstash/outputs/syslog.rb +145 -0
- data/lib/logstash/outputs/tcp.rb +145 -0
- data/lib/logstash/outputs/udp.rb +38 -0
- data/lib/logstash/outputs/websocket.rb +46 -0
- data/lib/logstash/outputs/websocket/app.rb +29 -0
- data/lib/logstash/outputs/websocket/pubsub.rb +45 -0
- data/lib/logstash/outputs/xmpp.rb +78 -0
- data/lib/logstash/outputs/zabbix.rb +108 -0
- data/lib/logstash/outputs/zeromq.rb +125 -0
- data/lib/logstash/pipeline.rb +286 -0
- data/lib/logstash/plugin.rb +150 -0
- data/lib/logstash/plugin_mixins/aws_config.rb +93 -0
- data/lib/logstash/program.rb +15 -0
- data/lib/logstash/runner.rb +238 -0
- data/lib/logstash/sized_queue.rb +8 -0
- data/lib/logstash/test.rb +183 -0
- data/lib/logstash/threadwatchdog.rb +37 -0
- data/lib/logstash/time_addon.rb +33 -0
- data/lib/logstash/util.rb +106 -0
- data/lib/logstash/util/buftok.rb +139 -0
- data/lib/logstash/util/charset.rb +39 -0
- data/lib/logstash/util/fieldreference.rb +50 -0
- data/lib/logstash/util/password.rb +25 -0
- data/lib/logstash/util/prctl.rb +11 -0
- data/lib/logstash/util/relp.rb +326 -0
- data/lib/logstash/util/require-helper.rb +18 -0
- data/lib/logstash/util/socket_peer.rb +7 -0
- data/lib/logstash/util/zenoss.rb +566 -0
- data/lib/logstash/util/zeromq.rb +47 -0
- data/lib/logstash/version.rb +6 -0
- data/locales/en.yml +170 -0
- data/logstash-event.gemspec +29 -0
- data/logstash.gemspec +128 -0
- data/patterns/firewalls +60 -0
- data/patterns/grok-patterns +91 -0
- data/patterns/haproxy +37 -0
- data/patterns/java +3 -0
- data/patterns/linux-syslog +14 -0
- data/patterns/mcollective +1 -0
- data/patterns/mcollective-patterns +4 -0
- data/patterns/nagios +108 -0
- data/patterns/postgresql +3 -0
- data/patterns/redis +3 -0
- data/patterns/ruby +2 -0
- data/pkg/build.sh +135 -0
- data/pkg/centos/after-install.sh +1 -0
- data/pkg/centos/before-install.sh +10 -0
- data/pkg/centos/before-remove.sh +11 -0
- data/pkg/centos/sysconfig +15 -0
- data/pkg/debian/after-install.sh +5 -0
- data/pkg/debian/before-install.sh +13 -0
- data/pkg/debian/before-remove.sh +13 -0
- data/pkg/debian/build.sh +34 -0
- data/pkg/debian/debian/README +6 -0
- data/pkg/debian/debian/changelog +17 -0
- data/pkg/debian/debian/compat +1 -0
- data/pkg/debian/debian/control +16 -0
- data/pkg/debian/debian/copyright +27 -0
- data/pkg/debian/debian/dirs +19 -0
- data/pkg/debian/debian/docs +0 -0
- data/pkg/debian/debian/logstash.default +39 -0
- data/pkg/debian/debian/logstash.init +201 -0
- data/pkg/debian/debian/logstash.install +1 -0
- data/pkg/debian/debian/logstash.logrotate +9 -0
- data/pkg/debian/debian/logstash.postinst +68 -0
- data/pkg/debian/debian/logstash.postrm +23 -0
- data/pkg/debian/debian/manpage.1.ex +59 -0
- data/pkg/debian/debian/preinst.ex +37 -0
- data/pkg/debian/debian/prerm.ex +40 -0
- data/pkg/debian/debian/release.conf +5 -0
- data/pkg/debian/debian/rules +80 -0
- data/pkg/debian/debian/watch.ex +22 -0
- data/pkg/logrotate.conf +8 -0
- data/pkg/logstash-web.default +41 -0
- data/pkg/logstash-web.sysv.debian +201 -0
- data/pkg/logstash-web.upstart.ubuntu +18 -0
- data/pkg/logstash.default +45 -0
- data/pkg/logstash.sysv.debian +202 -0
- data/pkg/logstash.sysv.redhat +158 -0
- data/pkg/logstash.upstart.ubuntu +20 -0
- data/pkg/rpm/SOURCES/logstash.conf +26 -0
- data/pkg/rpm/SOURCES/logstash.init +80 -0
- data/pkg/rpm/SOURCES/logstash.logrotate +8 -0
- data/pkg/rpm/SOURCES/logstash.sysconfig +3 -0
- data/pkg/rpm/SOURCES/logstash.wrapper +105 -0
- data/pkg/rpm/SPECS/logstash.spec +180 -0
- data/pkg/rpm/readme.md +4 -0
- data/pkg/ubuntu/after-install.sh +7 -0
- data/pkg/ubuntu/before-install.sh +12 -0
- data/pkg/ubuntu/before-remove.sh +13 -0
- data/pull_release_note.rb +25 -0
- data/require-analyze.rb +22 -0
- data/spec/README.md +14 -0
- data/spec/codecs/edn.rb +40 -0
- data/spec/codecs/edn_lines.rb +53 -0
- data/spec/codecs/graphite.rb +96 -0
- data/spec/codecs/json.rb +57 -0
- data/spec/codecs/json_lines.rb +51 -0
- data/spec/codecs/json_spooler.rb +43 -0
- data/spec/codecs/msgpack.rb +39 -0
- data/spec/codecs/multiline.rb +60 -0
- data/spec/codecs/oldlogstashjson.rb +55 -0
- data/spec/codecs/plain.rb +35 -0
- data/spec/codecs/spool.rb +35 -0
- data/spec/conditionals/test.rb +323 -0
- data/spec/config.rb +31 -0
- data/spec/event.rb +165 -0
- data/spec/examples/fail2ban.rb +28 -0
- data/spec/examples/graphite-input.rb +41 -0
- data/spec/examples/mysql-slow-query.rb +70 -0
- data/spec/examples/parse-apache-logs.rb +66 -0
- data/spec/examples/parse-haproxy-logs.rb +115 -0
- data/spec/examples/syslog.rb +48 -0
- data/spec/filters/alter.rb +96 -0
- data/spec/filters/anonymize.rb +189 -0
- data/spec/filters/checksum.rb +41 -0
- data/spec/filters/clone.rb +67 -0
- data/spec/filters/collate.rb +122 -0
- data/spec/filters/csv.rb +174 -0
- data/spec/filters/date.rb +285 -0
- data/spec/filters/date_performance.rb +31 -0
- data/spec/filters/dns.rb +159 -0
- data/spec/filters/drop.rb +19 -0
- data/spec/filters/elapsed.rb +294 -0
- data/spec/filters/environment.rb +43 -0
- data/spec/filters/geoip.rb +62 -0
- data/spec/filters/grep.rb +342 -0
- data/spec/filters/grok.rb +473 -0
- data/spec/filters/grok/timeout2.rb +56 -0
- data/spec/filters/grok/timeouts.rb +39 -0
- data/spec/filters/i18n.rb +25 -0
- data/spec/filters/json.rb +72 -0
- data/spec/filters/json_encode.rb +37 -0
- data/spec/filters/kv.rb +403 -0
- data/spec/filters/metrics.rb +212 -0
- data/spec/filters/multiline.rb +119 -0
- data/spec/filters/mutate.rb +180 -0
- data/spec/filters/noop.rb +221 -0
- data/spec/filters/prune.rb +441 -0
- data/spec/filters/punct.rb +18 -0
- data/spec/filters/railsparallelrequest.rb +112 -0
- data/spec/filters/range.rb +169 -0
- data/spec/filters/split.rb +58 -0
- data/spec/filters/translate.rb +70 -0
- data/spec/filters/unique.rb +25 -0
- data/spec/filters/useragent.rb +42 -0
- data/spec/filters/xml.rb +157 -0
- data/spec/inputs/file.rb +107 -0
- data/spec/inputs/gelf.rb +52 -0
- data/spec/inputs/generator.rb +30 -0
- data/spec/inputs/imap.rb +60 -0
- data/spec/inputs/redis.rb +63 -0
- data/spec/inputs/relp.rb +70 -0
- data/spec/inputs/tcp.rb +101 -0
- data/spec/jar.rb +21 -0
- data/spec/outputs/csv.rb +266 -0
- data/spec/outputs/elasticsearch.rb +161 -0
- data/spec/outputs/elasticsearch_http.rb +240 -0
- data/spec/outputs/email.rb +173 -0
- data/spec/outputs/file.rb +82 -0
- data/spec/outputs/graphite.rb +236 -0
- data/spec/outputs/redis.rb +127 -0
- data/spec/speed.rb +20 -0
- data/spec/sqlite-test.rb +81 -0
- data/spec/support/LOGSTASH-733.rb +21 -0
- data/spec/support/LOGSTASH-820.rb +25 -0
- data/spec/support/akamai-grok.rb +26 -0
- data/spec/support/date-http.rb +17 -0
- data/spec/support/postwait1.rb +26 -0
- data/spec/support/pull375.rb +21 -0
- data/spec/test_utils.rb +125 -0
- data/spec/util/fieldeval_spec.rb +44 -0
- data/test/jenkins/config.xml.erb +74 -0
- data/test/jenkins/create-jobs.rb +23 -0
- data/test/jenkins/generatorjob.config.xml +66 -0
- data/tools/Gemfile +14 -0
- data/tools/Gemfile.jruby-1.9.lock +322 -0
- data/tools/Gemfile.rbx-2.1.lock +516 -0
- data/tools/Gemfile.ruby-1.9.1.lock +310 -0
- data/tools/Gemfile.ruby-2.0.0.lock +310 -0
- metadata +629 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/filters/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
require "yaml"
|
5
|
+
|
6
|
+
# This filter let's you create a checksum based on various parts
|
7
|
+
# of the logstash event.
|
8
|
+
# This can be useful for deduplication of messages or simply to provide
|
9
|
+
# a custom unique identifier.
|
10
|
+
#
|
11
|
+
# This is VERY experimental and is largely a proof-of-concept
|
12
|
+
class LogStash::Filters::Checksum < LogStash::Filters::Base
|
13
|
+
|
14
|
+
config_name "checksum"
|
15
|
+
milestone 1
|
16
|
+
|
17
|
+
ALGORITHMS = ["md5", "sha", "sha1", "sha256", "sha384",]
|
18
|
+
|
19
|
+
# A list of keys to use in creating the string to checksum
|
20
|
+
# Keys will be sorted before building the string
|
21
|
+
# keys and values will then be concatenated with pipe delimeters
|
22
|
+
# and checksummed
|
23
|
+
config :keys, :validate => :array, :default => ["message", "@timestamp", "type"]
|
24
|
+
|
25
|
+
config :algorithm, :validate => ALGORITHMS, :default => "sha256"
|
26
|
+
|
27
|
+
public
|
28
|
+
def register
|
29
|
+
require 'openssl'
|
30
|
+
@to_checksum = ""
|
31
|
+
end
|
32
|
+
|
33
|
+
public
|
34
|
+
def filter(event)
|
35
|
+
return unless filter?(event)
|
36
|
+
|
37
|
+
@logger.debug("Running checksum filter", :event => event)
|
38
|
+
|
39
|
+
@keys.sort.each do |k|
|
40
|
+
@logger.debug("Adding key to string", :current_key => k)
|
41
|
+
@to_checksum << "|#{k}|#{event[k]}"
|
42
|
+
end
|
43
|
+
@to_checksum << "|"
|
44
|
+
@logger.debug("Final string built", :to_checksum => @to_checksum)
|
45
|
+
|
46
|
+
digested_string = OpenSSL::Digest.hexdigest(@algorithm, @to_checksum)
|
47
|
+
@logger.debug("Digested string", :digested_string => digested_string)
|
48
|
+
event['logstash_checksum'] = digested_string
|
49
|
+
end
|
50
|
+
end # class LogStash::Filters::Checksum
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/filters/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
require "ipaddr"
|
5
|
+
|
6
|
+
# The CIDR filter is for checking IP addresses in events against a list of
|
7
|
+
# network blocks that might contain it. Multiple addresses can be checked
|
8
|
+
# against multiple networks, any match succeeds. Upon success additional tags
|
9
|
+
# and/or fields can be added to the event.
|
10
|
+
|
11
|
+
class LogStash::Filters::CIDR < LogStash::Filters::Base
|
12
|
+
|
13
|
+
config_name "cidr"
|
14
|
+
milestone 1
|
15
|
+
|
16
|
+
# The IP address(es) to check with. Example:
|
17
|
+
#
|
18
|
+
# filter {
|
19
|
+
# %PLUGIN% {
|
20
|
+
# add_tag => [ "testnet" ]
|
21
|
+
# address => [ "%{src_ip}", "%{dst_ip}" ]
|
22
|
+
# network => [ "192.0.2.0/24" ]
|
23
|
+
# }
|
24
|
+
# }
|
25
|
+
config :address, :validate => :array, :default => []
|
26
|
+
|
27
|
+
# The IP network(s) to check against. Example:
|
28
|
+
#
|
29
|
+
# filter {
|
30
|
+
# %PLUGIN% {
|
31
|
+
# add_tag => [ "linklocal" ]
|
32
|
+
# address => [ "%{clientip}" ]
|
33
|
+
# network => [ "169.254.0.0/16", "fe80::/64" ]
|
34
|
+
# }
|
35
|
+
# }
|
36
|
+
config :network, :validate => :array, :default => []
|
37
|
+
|
38
|
+
public
|
39
|
+
def register
|
40
|
+
# Nothing
|
41
|
+
end # def register
|
42
|
+
|
43
|
+
public
|
44
|
+
def filter(event)
|
45
|
+
return unless filter?(event)
|
46
|
+
|
47
|
+
address = @address.collect do |a|
|
48
|
+
begin
|
49
|
+
IPAddr.new(event.sprintf(a))
|
50
|
+
rescue ArgumentError => e
|
51
|
+
@logger.warn("Invalid IP address, skipping", :address => a, :event => event)
|
52
|
+
nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
address.compact!
|
56
|
+
|
57
|
+
network = @network.collect do |n|
|
58
|
+
begin
|
59
|
+
IPAddr.new(event.sprintf(n))
|
60
|
+
rescue ArgumentError => e
|
61
|
+
@logger.warn("Invalid IP network, skipping", :network => n, :event => event)
|
62
|
+
nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
network.compact!
|
66
|
+
|
67
|
+
# Try every combination of address and network, first match wins
|
68
|
+
address.product(network).each do |a, n|
|
69
|
+
@logger.debug("Checking IP inclusion", :address => a, :network => n)
|
70
|
+
if n.include?(a)
|
71
|
+
filter_matched(event)
|
72
|
+
return
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end # def filter
|
76
|
+
end # class LogStash::Filters::CIDR
|
@@ -0,0 +1,145 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/filters/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
|
5
|
+
# This filter parses a source and apply a cipher or decipher before
|
6
|
+
# storing it in the target.
|
7
|
+
#
|
8
|
+
class LogStash::Filters::Cipher < LogStash::Filters::Base
|
9
|
+
config_name "cipher"
|
10
|
+
milestone 1
|
11
|
+
|
12
|
+
# The field to perform filter
|
13
|
+
#
|
14
|
+
# Example, to use the @message field (default) :
|
15
|
+
#
|
16
|
+
# filter { cipher { source => "message" } }
|
17
|
+
config :source, :validate => :string, :default => "message"
|
18
|
+
|
19
|
+
# The name of the container to put the result
|
20
|
+
#
|
21
|
+
# Example, to place the result into crypt :
|
22
|
+
#
|
23
|
+
# filter { cipher { target => "crypt" } }
|
24
|
+
config :target, :validate => :string, :default => "message"
|
25
|
+
|
26
|
+
# Do we have to perform a base64 decode or encode?
|
27
|
+
#
|
28
|
+
# If we are decrypting, base64 decode will be done before.
|
29
|
+
# If we are encrypting, base64 will be done after.
|
30
|
+
#
|
31
|
+
config :base64, :validate => :boolean, :default => true
|
32
|
+
|
33
|
+
# The key to use
|
34
|
+
config :key, :validate => :string
|
35
|
+
|
36
|
+
# The key size to pad
|
37
|
+
#
|
38
|
+
# It depends of the cipher algorythm.I your key don't need
|
39
|
+
# padding, don't set this parameter
|
40
|
+
#
|
41
|
+
# Example, for AES-256, we must have 32 char long key
|
42
|
+
# filter { cipher { key_size => 32 }
|
43
|
+
#
|
44
|
+
config :key_size, :validate => :number, :default => 32
|
45
|
+
|
46
|
+
# The character used to pad the key
|
47
|
+
config :key_pad, :default => "\0"
|
48
|
+
|
49
|
+
# The cipher algorythm
|
50
|
+
#
|
51
|
+
# A list of supported algorithms can be obtained by
|
52
|
+
#
|
53
|
+
# puts OpenSSL::Cipher.ciphers
|
54
|
+
config :algorithm, :validate => :string, :required => true
|
55
|
+
|
56
|
+
# Encrypting or decrypting some data
|
57
|
+
#
|
58
|
+
# Valid values are encrypt or decrypt
|
59
|
+
config :mode, :validate => :string, :required => true
|
60
|
+
|
61
|
+
# Cypher padding to use. Enables or disables padding.
|
62
|
+
#
|
63
|
+
# By default encryption operations are padded using standard block padding
|
64
|
+
# and the padding is checked and removed when decrypting. If the pad
|
65
|
+
# parameter is zero then no padding is performed, the total amount of data
|
66
|
+
# encrypted or decrypted must then be a multiple of the block size or an
|
67
|
+
# error will occur.
|
68
|
+
#
|
69
|
+
# See EVP_CIPHER_CTX_set_padding for further information.
|
70
|
+
#
|
71
|
+
# We are using Openssl jRuby which uses default padding to PKCS5Padding
|
72
|
+
# If you want to change it, set this parameter. If you want to disable
|
73
|
+
# it, Set this parameter to 0
|
74
|
+
# filter { cipher { padding => 0 }}
|
75
|
+
config :cipher_padding, :validate => :string
|
76
|
+
|
77
|
+
# The initialization vector to use
|
78
|
+
#
|
79
|
+
# The cipher modes CBC, CFB, OFB and CTR all need an "initialization
|
80
|
+
# vector", or short, IV. ECB mode is the only mode that does not require
|
81
|
+
# an IV, but there is almost no legitimate use case for this mode
|
82
|
+
# because of the fact that it does not sufficiently hide plaintext patterns.
|
83
|
+
config :iv, :validate => :string
|
84
|
+
|
85
|
+
def register
|
86
|
+
require 'base64' if @base64
|
87
|
+
init_cipher
|
88
|
+
end # def register
|
89
|
+
|
90
|
+
|
91
|
+
def filter(event)
|
92
|
+
return unless filter?(event)
|
93
|
+
|
94
|
+
|
95
|
+
#If decrypt or encrypt fails, we keep it it intact.
|
96
|
+
begin
|
97
|
+
#@logger.debug("Event to filter", :event => event)
|
98
|
+
data = event[@source]
|
99
|
+
if @mode == "decrypt"
|
100
|
+
data = Base64.decode64(data) if @base64 == true
|
101
|
+
end
|
102
|
+
result = @cipher.update(data) + @cipher.final
|
103
|
+
if @mode == "encrypt"
|
104
|
+
data = Base64.encode64(data) if @base64 == true
|
105
|
+
end
|
106
|
+
rescue => e
|
107
|
+
@logger.warn("Exception catch on cipher filter", :event => event, :error => e)
|
108
|
+
else
|
109
|
+
event[@target]= result
|
110
|
+
#Is it necessary to add 'if !result.nil?' ? exception have been already catched.
|
111
|
+
#In doubt, I keep it.
|
112
|
+
filter_matched(event) if !result.nil?
|
113
|
+
#Too much bad result can be a problem, reinit cipher prevent this.
|
114
|
+
init_cipher
|
115
|
+
end
|
116
|
+
end # def filter
|
117
|
+
|
118
|
+
def init_cipher
|
119
|
+
|
120
|
+
@cipher = OpenSSL::Cipher.new(@algorithm)
|
121
|
+
if @mode == "encrypt"
|
122
|
+
@cipher.encrypt
|
123
|
+
elsif @mode == "decrypt"
|
124
|
+
@cipher.decrypt
|
125
|
+
else
|
126
|
+
@logger.error("Invalid cipher mode. Valid values are \"encrypt\" or \"decrypt\"", :mode => @mode)
|
127
|
+
raise "Bad configuration, aborting."
|
128
|
+
end
|
129
|
+
|
130
|
+
if @key.length != @key_size
|
131
|
+
@logger.debug("key length is " + @key.length.to_s + ", padding it to " + @key_size.to_s + " with '" + @key_pad.to_s + "'")
|
132
|
+
@key = @key[0,@key_size].ljust(@key_size,@key_pad)
|
133
|
+
end
|
134
|
+
|
135
|
+
@cipher.key = @key
|
136
|
+
|
137
|
+
@cipher.iv = @iv if @iv
|
138
|
+
|
139
|
+
@cipher.padding = @cipher_padding if @cipher_padding
|
140
|
+
|
141
|
+
@logger.debug("Cipher initialisation done", :mode => @mode, :key => @key, :iv => @iv, :cipher_padding => @cipher_padding)
|
142
|
+
end # def init_cipher
|
143
|
+
|
144
|
+
|
145
|
+
end # class LogStash::Filters::Cipher
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/filters/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
|
5
|
+
# The clone filter is for duplicating events.
|
6
|
+
# A clone will be made for each type in the clone list.
|
7
|
+
# The original event is left unchanged.
|
8
|
+
class LogStash::Filters::Clone < LogStash::Filters::Base
|
9
|
+
|
10
|
+
config_name "clone"
|
11
|
+
milestone 2
|
12
|
+
|
13
|
+
# A new clone will be created with the given type for each type in this list.
|
14
|
+
config :clones, :validate => :array, :default => []
|
15
|
+
|
16
|
+
public
|
17
|
+
def register
|
18
|
+
# Nothing to do
|
19
|
+
end
|
20
|
+
|
21
|
+
public
|
22
|
+
def filter(event)
|
23
|
+
return unless filter?(event)
|
24
|
+
@clones.each do |type|
|
25
|
+
clone = event.clone
|
26
|
+
clone["type"] = type
|
27
|
+
filter_matched(clone)
|
28
|
+
@logger.debug("Cloned event", :clone => clone, :event => event)
|
29
|
+
|
30
|
+
# Push this new event onto the stack at the LogStash::FilterWorker
|
31
|
+
yield clone
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end # class LogStash::Filters::Clone
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/filters/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
|
5
|
+
# Collate events by time or count.
|
6
|
+
#
|
7
|
+
# The original goal of this filter was to merge the logs from different sources
|
8
|
+
# by the time of log, for example, in real-time log collection, logs can be
|
9
|
+
# collated by amount of 3000 logs or can be collated in 30 seconds.
|
10
|
+
#
|
11
|
+
# The config looks like this:
|
12
|
+
#
|
13
|
+
# filter {
|
14
|
+
# collate {
|
15
|
+
# size => 3000
|
16
|
+
# interval => "30s"
|
17
|
+
# order => "ascending"
|
18
|
+
# }
|
19
|
+
# }
|
20
|
+
class LogStash::Filters::Collate < LogStash::Filters::Base
|
21
|
+
|
22
|
+
config_name "collate"
|
23
|
+
milestone 1
|
24
|
+
|
25
|
+
# How many logs should be collated.
|
26
|
+
config :count, :validate => :number, :default => 1000
|
27
|
+
|
28
|
+
# The 'interval' is the time window which how long the logs should be collated. (default 1m)
|
29
|
+
config :interval, :validate => :string, :default => "1m"
|
30
|
+
|
31
|
+
# The 'order' collated events should appear in.
|
32
|
+
config :order, :validate => ["ascending", "descending"], :default => "ascending"
|
33
|
+
|
34
|
+
public
|
35
|
+
def register
|
36
|
+
require "thread"
|
37
|
+
require "rufus/scheduler"
|
38
|
+
|
39
|
+
@mutex = Mutex.new
|
40
|
+
@collatingDone = false
|
41
|
+
@collatingArray = Array.new
|
42
|
+
@scheduler = Rufus::Scheduler.start_new
|
43
|
+
@job = @scheduler.every @interval do
|
44
|
+
@logger.info("Scheduler Activated")
|
45
|
+
@mutex.synchronize{
|
46
|
+
collate
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end # def register
|
50
|
+
|
51
|
+
public
|
52
|
+
def filter(event)
|
53
|
+
@logger.info("do collate filter")
|
54
|
+
if event == LogStash::SHUTDOWN
|
55
|
+
@job.trigger()
|
56
|
+
@job.unschedule()
|
57
|
+
@logger.info("collate filter thread shutdown.")
|
58
|
+
return
|
59
|
+
end
|
60
|
+
|
61
|
+
# if the event is collated, a "collated" tag will be marked, so for those uncollated event, cancel them first.
|
62
|
+
if event["tags"].nil? || !event.tags.include?("collated")
|
63
|
+
event.cancel
|
64
|
+
else
|
65
|
+
return
|
66
|
+
end
|
67
|
+
|
68
|
+
@mutex.synchronize{
|
69
|
+
@collatingArray.push(event.clone)
|
70
|
+
|
71
|
+
if (@collatingArray.length == @count)
|
72
|
+
collate
|
73
|
+
end
|
74
|
+
|
75
|
+
if (@collatingDone)
|
76
|
+
while collatedEvent = @collatingArray.pop
|
77
|
+
collatedEvent["tags"] = Array.new if collatedEvent["tags"].nil?
|
78
|
+
collatedEvent["tags"] << "collated"
|
79
|
+
filter_matched(collatedEvent)
|
80
|
+
yield collatedEvent
|
81
|
+
end # while @collatingArray.pop
|
82
|
+
# reset collatingDone flag
|
83
|
+
@collatingDone = false
|
84
|
+
end
|
85
|
+
}
|
86
|
+
end # def filter
|
87
|
+
|
88
|
+
private
|
89
|
+
def collate
|
90
|
+
if (@order == "ascending")
|
91
|
+
@collatingArray.sort! { |eventA, eventB| eventB.timestamp <=> eventA.timestamp }
|
92
|
+
else
|
93
|
+
@collatingArray.sort! { |eventA, eventB| eventA.timestamp <=> eventB.timestamp }
|
94
|
+
end
|
95
|
+
@collatingDone = true
|
96
|
+
end # def collate
|
97
|
+
|
98
|
+
# Flush any pending messages.
|
99
|
+
public
|
100
|
+
def flush
|
101
|
+
events = []
|
102
|
+
if (@collatingDone)
|
103
|
+
@mutex.synchronize{
|
104
|
+
while collatedEvent = @collatingArray.pop
|
105
|
+
collatedEvent["tags"] << "collated"
|
106
|
+
events << collatedEvent
|
107
|
+
end # while @collatingArray.pop
|
108
|
+
}
|
109
|
+
# reset collatingDone flag.
|
110
|
+
@collatingDone = false
|
111
|
+
end
|
112
|
+
return events
|
113
|
+
end # def flush
|
114
|
+
end #
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/filters/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
|
5
|
+
require "csv"
|
6
|
+
|
7
|
+
# CSV filter. Takes an event field containing CSV data, parses it,
|
8
|
+
# and stores it as individual fields (can optionally specify the names).
|
9
|
+
class LogStash::Filters::CSV < LogStash::Filters::Base
|
10
|
+
config_name "csv"
|
11
|
+
milestone 2
|
12
|
+
|
13
|
+
# The CSV data in the value of the source field will be expanded into a
|
14
|
+
# datastructure.
|
15
|
+
config :source, :validate => :string, :default => "message"
|
16
|
+
|
17
|
+
# Define a list of column names (in the order they appear in the CSV,
|
18
|
+
# as if it were a header line). If this is not specified or there
|
19
|
+
# are not enough columns specified, the default column name is "columnX"
|
20
|
+
# (where X is the field number, starting from 1).
|
21
|
+
config :columns, :validate => :array, :default => []
|
22
|
+
|
23
|
+
# Define the column separator value. If this is not specified the default
|
24
|
+
# is a comma ','.
|
25
|
+
# Optional.
|
26
|
+
config :separator, :validate => :string, :default => ","
|
27
|
+
|
28
|
+
# Define the character used to quote CSV fields. If this is not specified
|
29
|
+
# the default is a double quote '"'.
|
30
|
+
# Optional.
|
31
|
+
config :quote_char, :validate => :string, :default => '"'
|
32
|
+
|
33
|
+
# Define target for placing the data.
|
34
|
+
# Defaults to writing to the root of the event.
|
35
|
+
config :target, :validate => :string
|
36
|
+
|
37
|
+
public
|
38
|
+
def register
|
39
|
+
|
40
|
+
# Nothing to do here
|
41
|
+
|
42
|
+
end # def register
|
43
|
+
|
44
|
+
public
|
45
|
+
def filter(event)
|
46
|
+
return unless filter?(event)
|
47
|
+
|
48
|
+
@logger.debug("Running csv filter", :event => event)
|
49
|
+
|
50
|
+
matches = 0
|
51
|
+
|
52
|
+
if event[@source]
|
53
|
+
if event[@source].is_a?(String)
|
54
|
+
event[@source] = [event[@source]]
|
55
|
+
end
|
56
|
+
|
57
|
+
if event[@source].length > 1
|
58
|
+
@logger.warn("csv filter only works on fields of length 1",
|
59
|
+
:source => @source, :value => event[@source],
|
60
|
+
:event => event)
|
61
|
+
return
|
62
|
+
end
|
63
|
+
|
64
|
+
raw = event[@source].first
|
65
|
+
begin
|
66
|
+
values = CSV.parse_line(raw, :col_sep => @separator, :quote_char => @quote_char)
|
67
|
+
|
68
|
+
if @target.nil?
|
69
|
+
# Default is to write to the root of the event.
|
70
|
+
dest = event
|
71
|
+
else
|
72
|
+
dest = event[@target] ||= {}
|
73
|
+
end
|
74
|
+
|
75
|
+
values.each_index do |i|
|
76
|
+
field_name = @columns[i] || "column#{i+1}"
|
77
|
+
dest[field_name] = values[i]
|
78
|
+
end
|
79
|
+
|
80
|
+
filter_matched(event)
|
81
|
+
rescue => e
|
82
|
+
event.tag "_csvparsefailure"
|
83
|
+
@logger.warn("Trouble parsing csv", :source => @source, :raw => raw,
|
84
|
+
:exception => e)
|
85
|
+
return
|
86
|
+
end # begin
|
87
|
+
end # if event
|
88
|
+
|
89
|
+
@logger.debug("Event after csv filter", :event => event)
|
90
|
+
|
91
|
+
end # def filter
|
92
|
+
|
93
|
+
end # class LogStash::Filters::Csv
|
94
|
+
|