├── docker ├── .dockerignore ├── build_docker.sh ├── Dockerfile.final └── Dockerfile ├── logstreamer ├── testdir │ ├── filehandling │ │ ├── 2010 │ │ │ ├── 05 │ │ │ │ ├── access.log │ │ │ │ ├── access.log.1 │ │ │ │ ├── access.log.2 │ │ │ │ └── access.log.3 │ │ │ ├── 07 │ │ │ │ ├── access.log │ │ │ │ ├── access.log.1 │ │ │ │ ├── access.log.2 │ │ │ │ ├── error.log.1 │ │ │ │ ├── error.log.2 │ │ │ │ └── error.log │ │ │ └── 08 │ │ │ │ ├── access.log │ │ │ │ ├── access.log.1 │ │ │ │ ├── access.log.2 │ │ │ │ ├── access.log.3 │ │ │ │ ├── access.log.4 │ │ │ │ ├── error.log │ │ │ │ ├── error.log.1 │ │ │ │ ├── error.log.2 │ │ │ │ └── error.log.3 │ │ ├── 2012 │ │ │ ├── 04 │ │ │ │ ├── access.log │ │ │ │ ├── access.log.1 │ │ │ │ ├── access.log.2 │ │ │ │ ├── access.log.3 │ │ │ │ ├── error.log │ │ │ │ └── error.log.1 │ │ │ └── 09 │ │ │ │ ├── access.log │ │ │ │ ├── access.log.1 │ │ │ │ ├── error.log │ │ │ │ ├── error.log.1 │ │ │ │ ├── error.log.2 │ │ │ │ ├── error.log.3 │ │ │ │ ├── error.log.4 │ │ │ │ └── error.log.5 │ │ ├── 2013 │ │ │ ├── 01 │ │ │ │ ├── access.log │ │ │ │ ├── access.log.1 │ │ │ │ ├── error.log │ │ │ │ ├── error.log.1 │ │ │ │ ├── error.log.2 │ │ │ │ └── error.log.3 │ │ │ ├── 04 │ │ │ │ ├── access.log │ │ │ │ ├── access.log.1 │ │ │ │ ├── access.log.2 │ │ │ │ ├── access.log.3 │ │ │ │ ├── error.log │ │ │ │ └── error.log.1 │ │ │ └── 08 │ │ │ │ ├── access.log.1 │ │ │ │ ├── error.log.1 │ │ │ │ ├── error.log.2 │ │ │ │ ├── error.log.4 │ │ │ │ └── access.log │ │ └── subdir │ │ │ ├── file.log.2 │ │ │ └── file.log.1 │ ├── shortlog │ │ └── short.log │ └── reader │ │ └── location.json └── logstream_specs_test.go ├── sandbox ├── lua │ ├── testsupport │ │ ├── constant_module.lua │ │ ├── simple_count.lua.data │ │ ├── input_error.lua │ │ ├── require.lua │ │ ├── modules │ │ │ └── dummy.lua │ │ ├── serialize_noglobal.lua │ │ ├── multipack_decoder.lua │ │ ├── hello_world.lua │ │ ├── serialize_failure.lua │ │ ├── input.lua │ │ ├── encoder_writemessage.lua │ │ ├── encoder_raw.lua │ │ ├── read_raw.lua │ │ ├── readint.lua │ │ ├── readfield.lua │ │ ├── readstring.lua │ │ ├── cjson.lua │ │ ├── loop.lua │ │ ├── process_message_error_string.lua │ │ ├── encoder_text.lua │ │ ├── backpressure.lua │ │ ├── read_config_nil.lua │ │ ├── simple_count.lua │ │ ├── timerinject.lua │ │ ├── processinject.lua │ │ ├── encoder_protobuf.lua │ │ ├── output.lua │ │ ├── lpeg_csv.lua │ │ ├── encoder_json.lua │ │ ├── nagios.lua │ │ ├── hekabench_cbuf_counter.lua │ │ ├── read_config.lua │ │ ├── alert.lua │ │ ├── decoder.lua │ │ ├── field_scribble.lua │ │ ├── json_payload_transform_sr.lua │ │ ├── counter.lua │ │ ├── json_payload_transform.lua │ │ ├── annotation.lua │ │ └── graphite.lua │ └── encoders │ │ └── alert.lua └── plugins │ └── all_specs_test.go ├── plugins ├── process │ ├── testsupport │ │ ├── process_input_test.data │ │ ├── process_input_test.txt │ │ ├── process_input_pipes_test.data │ │ └── processes │ │ │ ├── 100 │ │ │ ├── h0.toml │ │ │ └── h1.toml │ │ │ ├── 200 │ │ │ └── h0.toml │ │ │ └── 300 │ │ │ └── h1.toml │ └── all_specs_test.go ├── testsupport │ ├── config_test_defaults2.toml │ ├── config_dir │ │ ├── nope.toml.no │ │ ├── two.toml │ │ └── one.toml │ ├── protobuf.log │ ├── bad_envs │ │ ├── config_1_test.toml │ │ └── config_2_test.toml │ ├── config_bad_test.toml │ ├── config_bad_outputs.toml │ ├── config_env_test.toml │ ├── config_bad_params.toml │ ├── config_test_defaults.toml │ ├── multiline.log │ ├── config_test_common.toml │ ├── config_test.toml │ ├── config_test_multidecoder.toml │ ├── support.go │ ├── config_test_multidecoder_nested.toml │ ├── config_test_multidecoder_nested_cyclic.toml │ ├── test-zeus-incomplete.log │ └── test-severity.log ├── http │ ├── http_util.go │ └── all_spec_test.go ├── smtp │ └── all_spec_test.go ├── file │ └── all_spec_test.go ├── payload │ └── all_spec_test.go ├── statsd │ └── all_spec_test.go ├── udp │ └── all_specs_test.go ├── graphite │ └── all_spec_test.go ├── tcp │ ├── all_specs_test.go │ └── testsupport │ │ └── cert.pem ├── all_specs_test.go ├── docker │ └── client.go ├── utils.go └── scribble_decoder_test.go ├── dasher ├── images │ └── spinner.gif ├── fonts │ ├── OpenSans-Bold.eot │ ├── OpenSans-Bold.ttf │ ├── OpenSans-Bold.woff │ ├── OpenSans-Light.eot │ ├── OpenSans-Light.ttf │ ├── OpenSans-Italic.eot │ ├── OpenSans-Italic.ttf │ ├── OpenSans-Italic.woff │ ├── OpenSans-Light.woff │ ├── OpenSans-Regular.eot │ ├── OpenSans-Regular.ttf │ ├── OpenSans-Regular.woff │ ├── OpenSans-BoldItalic.eot │ ├── OpenSans-BoldItalic.ttf │ ├── OpenSans-BoldItalic.woff │ ├── OpenSans-LightItalic.eot │ ├── OpenSans-LightItalic.ttf │ ├── OpenSans-LightItalic.woff │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── javascript │ ├── templates │ │ ├── health │ │ │ ├── router_widget.mustache │ │ │ ├── inputs_row.mustache │ │ │ ├── inputs_index.mustache │ │ │ ├── channel_count_widget.mustache │ │ │ ├── globals_index.mustache │ │ │ ├── encoders_index.mustache │ │ │ ├── encoders_row.mustache │ │ │ ├── decoders_index.mustache │ │ │ ├── filters_index.mustache │ │ │ ├── outputs_index.mustache │ │ │ ├── health_index.mustache │ │ │ ├── decoders_row.mustache │ │ │ ├── plugins_row.mustache │ │ │ ├── filters_row.mustache │ │ │ ├── outputs_row.mustache │ │ │ └── plugins_show.mustache │ │ ├── sandboxes │ │ │ ├── sandbox_output_txt_show.mustache │ │ │ ├── sandboxes_index.mustache │ │ │ └── sandbox_output_cbuf_show.mustache │ │ └── termination_report │ │ │ └── termination_report_index.mustache │ ├── views │ │ ├── health │ │ │ ├── plugins_show.js │ │ │ ├── inputs_row.js │ │ │ ├── filters_row.js │ │ │ ├── outputs_row.js │ │ │ ├── decoders_row.js │ │ │ ├── encoders_row.js │ │ │ ├── router_widget.js │ │ │ ├── inputs_index.js │ │ │ ├── filters_index.js │ │ │ ├── outputs_index.js │ │ │ ├── decoders_index.js │ │ │ ├── encoders_index.js │ │ │ └── channel_count_widget.js │ │ ├── sandboxes │ │ │ └── sandboxes_index.js │ │ └── termination_report │ │ │ └── termination_report_index.js │ ├── models │ │ ├── sandbox_output.js │ │ └── sandbox.js │ ├── presenters │ │ ├── termination_report_row_presenter.js │ │ └── sandbox_output_presenter.js │ ├── lib │ │ └── termination_report.js │ ├── collections │ │ └── plugins.js │ └── adapters │ │ ├── termination_report_adapter.js │ │ └── sandbox_output_txt_adapter.js ├── yuidoc.json └── .jshintrc ├── docs └── source │ ├── images │ ├── health_1.png │ ├── health_2.png │ ├── sandboxes.png │ ├── sandbox_detail.png │ └── stat_graph_output.png │ ├── changelog.rst │ ├── sandbox │ ├── cookbook.rst │ ├── input.rst │ ├── output.rst │ ├── graph_annotation.rst │ ├── json_payload_transform.rst │ ├── encoder.rst │ └── index.rst │ ├── message │ └── header.dot │ ├── config │ ├── encoders │ │ ├── alert.rst │ │ ├── espayload.rst │ │ ├── cbuf_librato.rst │ │ ├── schema_influx.rst │ │ ├── statmetric_influx.rst │ │ ├── schema_carbon_line.rst │ │ ├── schema_influx_line.rst │ │ ├── index.rst │ │ ├── rst.rst │ │ ├── sandbox.rst │ │ ├── protobuf.rst │ │ ├── index_noref.rst │ │ └── payload.rst │ ├── decoders │ │ ├── json.rst │ │ ├── rsyslog.rst │ │ ├── linux_netdev.rst │ │ ├── linux_netstat.rst │ │ ├── nginx_error.rst │ │ ├── nginx_access.rst │ │ ├── apache_access.rst │ │ ├── linux_cpu_stats.rst │ │ ├── linux_load_avg.rst │ │ ├── linux_mem_stats.rst │ │ ├── linux_disk_stats.rst │ │ ├── nginx_stub_status.rst │ │ ├── mysql_slow_query.rst │ │ ├── graylog_extended.rst │ │ ├── sandbox.rst │ │ ├── index.rst │ │ ├── protobuf.rst │ │ └── stats_to_fields.rst │ ├── filters │ │ ├── cpu_stats.rst │ │ ├── load_avg.rst │ │ ├── stats_graph.rst │ │ ├── unique_items.rst │ │ ├── disk_stats.rst │ │ ├── mem_stats.rst │ │ ├── frequent_items.rst │ │ ├── heka_memstat.rst │ │ ├── http_status.rst │ │ ├── influx_batch.rst │ │ ├── mysql_slow_query.rst │ │ ├── message_schema.rst │ │ ├── cbuf_delta.rst │ │ ├── cbuf_delta_by_host.rst │ │ ├── message_failures.rst │ │ ├── counter.rst │ │ ├── sandbox.rst │ │ └── index_noref.rst │ ├── outputs │ │ ├── log.rst │ │ ├── sandbox.rst │ │ ├── carbon.rst │ │ ├── index_noref.rst │ │ └── udp.rst │ ├── splitters │ │ ├── index_noref.rst │ │ ├── null.rst │ │ ├── regex.rst │ │ └── token.rst │ └── inputs │ │ ├── file_polling.rst │ │ ├── statsd.rst │ │ ├── sandbox.rst │ │ └── index_noref.rst │ ├── man │ ├── plugin.rst │ ├── usage.rst │ └── config.rst │ └── developing │ └── release.rst ├── pipeline ├── testsupport │ ├── multi.dat │ ├── sample-config.toml │ └── sample-hostname.toml ├── errors.go ├── pipeline_signals_darwin.go ├── pipeline_signals_linux.go ├── pipeline_signals_freebsd.go ├── pipeline_signals_windows.go ├── doc.go └── all_specs_test.go ├── examples ├── conf │ └── hekad.toml └── example.toml ├── .dockerignore ├── .gitignore ├── .gitmodules ├── rpm ├── heka.postinst.in └── heka.preinst.in ├── cmd ├── heka-sbmgr │ └── sbmgr.toml └── heka-sbmgrload │ └── sbmgrload.toml ├── packaging └── debian │ ├── heka.postrm.in │ ├── heka.postinst.in │ ├── heka.service.in │ └── heka.preinst.in ├── env.bat ├── .travis.yml ├── .gitattributes ├── cmake ├── message_proto.cmake ├── CMakeDebHelperInstall.cmake ├── FindHg.cmake ├── FindProtobuf.cmake └── FindGo.cmake ├── env.sh ├── CPackConfig.cmake ├── LICENSE.txt ├── Dockerfile ├── client ├── client.go └── senders.go ├── ringbuf └── ringbuf_test.go └── README.md /docker/.dockerignore: -------------------------------------------------------------------------------- 1 | build.sh 2 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/05/access.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/05/access.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/05/access.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/05/access.log.3: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/07/access.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/07/access.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/07/access.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/07/error.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/08/access.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/08/access.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/08/access.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/08/access.log.3: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/08/access.log.4: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/08/error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/08/error.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/08/error.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/08/error.log.3: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/04/access.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/04/access.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/04/access.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/04/access.log.3: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/04/error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/04/error.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/09/access.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/09/access.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/09/error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/09/error.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/09/error.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/09/error.log.3: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/09/error.log.4: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2012/09/error.log.5: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/01/access.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/01/access.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/01/error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/01/error.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/01/error.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/01/error.log.3: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/04/access.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/04/access.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/04/access.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/04/access.log.3: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/04/error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/04/error.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/08/access.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/08/error.log.1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/08/error.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/08/error.log.4: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/subdir/file.log.2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/constant_module.lua: -------------------------------------------------------------------------------- 1 | return 43 2 | -------------------------------------------------------------------------------- /plugins/process/testsupport/process_input_test.data: -------------------------------------------------------------------------------- 1 | this|is|a|test| 2 | -------------------------------------------------------------------------------- /plugins/process/testsupport/process_input_test.txt: -------------------------------------------------------------------------------- 1 | this|is|a|test| 2 | -------------------------------------------------------------------------------- /plugins/testsupport/config_test_defaults2.toml: -------------------------------------------------------------------------------- 1 | [DefaultsTestOutput] 2 | -------------------------------------------------------------------------------- /dasher/images/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/images/spinner.gif -------------------------------------------------------------------------------- /sandbox/lua/testsupport/simple_count.lua.data: -------------------------------------------------------------------------------- 1 | _G["_VERSION"] = "Lua 5.1" 2 | _G["count"] = 10 3 | -------------------------------------------------------------------------------- /logstreamer/testdir/shortlog/short.log: -------------------------------------------------------------------------------- 1 | 0 This is a test 2 | 1 This is a test 3 | 2 This is a test 4 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/input_error.lua: -------------------------------------------------------------------------------- 1 | function process_message() 2 | error("boom") 3 | end 4 | -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Bold.eot -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Bold.woff -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Light.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Light.eot -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Light.ttf -------------------------------------------------------------------------------- /docs/source/images/health_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/docs/source/images/health_1.png -------------------------------------------------------------------------------- /docs/source/images/health_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/docs/source/images/health_2.png -------------------------------------------------------------------------------- /pipeline/testsupport/multi.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/pipeline/testsupport/multi.dat -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Italic.eot -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Italic.ttf -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Italic.woff -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Light.woff -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Regular.eot -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-Regular.woff -------------------------------------------------------------------------------- /docs/source/images/sandboxes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/docs/source/images/sandboxes.png -------------------------------------------------------------------------------- /plugins/testsupport/config_dir/nope.toml.no: -------------------------------------------------------------------------------- 1 | [not_loaded] 2 | type = "StatFilter" 3 | message_matcher = "TRUE" 4 | -------------------------------------------------------------------------------- /plugins/testsupport/protobuf.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/plugins/testsupport/protobuf.log -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-BoldItalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-BoldItalic.eot -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-BoldItalic.ttf -------------------------------------------------------------------------------- /plugins/process/testsupport/process_input_pipes_test.data: -------------------------------------------------------------------------------- 1 | this|is|a|test| 2 | ignore this line 3 | and this line 4 | -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-BoldItalic.woff -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-LightItalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-LightItalic.eot -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-LightItalic.ttf -------------------------------------------------------------------------------- /dasher/fonts/OpenSans-LightItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/OpenSans-LightItalic.woff -------------------------------------------------------------------------------- /docs/source/images/sandbox_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/docs/source/images/sandbox_detail.png -------------------------------------------------------------------------------- /docs/source/images/stat_graph_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/docs/source/images/stat_graph_output.png -------------------------------------------------------------------------------- /examples/conf/hekad.toml: -------------------------------------------------------------------------------- 1 | [hekad] 2 | maxprocs = 2 3 | 4 | [TcpInput] 5 | address = "127.0.0.1:5565" 6 | 7 | [StatAccumInput] 8 | -------------------------------------------------------------------------------- /dasher/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /dasher/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /dasher/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitro/heka/dev/dasher/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /docs/source/changelog.rst: -------------------------------------------------------------------------------- 1 | .. _changelog: 2 | 3 | ========= 4 | Changelog 5 | ========= 6 | 7 | .. literalinclude:: /../../CHANGES.txt 8 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/require.lua: -------------------------------------------------------------------------------- 1 | local constant = require "constant_module" 2 | 3 | function process_message() 4 | return constant 5 | end 6 | -------------------------------------------------------------------------------- /plugins/process/testsupport/processes/100/h0.toml: -------------------------------------------------------------------------------- 1 | [ProcessInput] 2 | [ProcessInput.command.0] 3 | bin = "echo" 4 | args = ["hello world\n"] 5 | 6 | -------------------------------------------------------------------------------- /plugins/process/testsupport/processes/200/h0.toml: -------------------------------------------------------------------------------- 1 | [ProcessInput] 2 | [ProcessInput.command.0] 3 | bin = "echo" 4 | args = ["hello world\n"] 5 | 6 | -------------------------------------------------------------------------------- /plugins/process/testsupport/processes/100/h1.toml: -------------------------------------------------------------------------------- 1 | [ProcessInput] 2 | [ProcessInput.command.0] 3 | bin = "echo" 4 | args = ["hello world again\n"] 5 | 6 | -------------------------------------------------------------------------------- /plugins/process/testsupport/processes/300/h1.toml: -------------------------------------------------------------------------------- 1 | [ProcessInput] 2 | [ProcessInput.command.0] 3 | bin = "echo" 4 | args = ["hello world again\n"] 5 | 6 | -------------------------------------------------------------------------------- /plugins/testsupport/bad_envs/config_1_test.toml: -------------------------------------------------------------------------------- 1 | [LogOutput] 2 | type = "LogOutput" 3 | message_matcher = "TRUE" 4 | encoder = "%ENV[this_has_no_ending" 5 | 6 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/router_widget.mustache: -------------------------------------------------------------------------------- 1 |

Router

2 |

{{ProcessMessageCountFormatted}}

3 |
Messages Processed
4 | -------------------------------------------------------------------------------- /plugins/testsupport/bad_envs/config_2_test.toml: -------------------------------------------------------------------------------- 1 | [TestOut] 2 | type = "LogOutput" 3 | message_matcher = "TRUE" 4 | encoder = "%ENV[ spaces arent allowed]" 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | docs/build 3 | build 4 | cmake/plugin_loader.cmake 5 | etc/ 6 | pipeline/mock_*.go 7 | var/ 8 | *.sw? 9 | externals 10 | dockerfile/* 11 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/inputs_row.mustache: -------------------------------------------------------------------------------- 1 | {{Name}} 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | docs/build 2 | sandbox/lua/lua_sandbox.go.in 3 | build 4 | cmake/plugin_loader.cmake 5 | etc/ 6 | pipeline/mock_*.go 7 | var/ 8 | *.sw? 9 | externals 10 | *~ 11 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "docs/source/_themes/mozilla"] 2 | path = docs/source/_themes/mozilla 3 | url = https://github.com/rafrombrc/mozilla-sphinx-theme.git 4 | branch = heka 5 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/modules/dummy.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | setfenv(1, M) -- Remove external access to contain everything in the module. 3 | 4 | version = "1.0.0" 5 | 6 | return M 7 | -------------------------------------------------------------------------------- /logstreamer/testdir/reader/location.json: -------------------------------------------------------------------------------- 1 | {"file_name":"/Users/ben/Programming/Go/heka/logstreamer/testdir/filehandling/2013/08/error.log","seek":1969,"last_hash":"72781af95a1583690cc97548fdcf3bb0efbe3119"} -------------------------------------------------------------------------------- /plugins/testsupport/config_bad_test.toml: -------------------------------------------------------------------------------- 1 | [udp_stats] 2 | type = "UdpInput" 3 | address = 1000 4 | 5 | [CounterOutput] 6 | type = "CounterOutput" 7 | message_matcher = "Type != \"heka.counter_output\"" 8 | -------------------------------------------------------------------------------- /rpm/heka.postinst.in: -------------------------------------------------------------------------------- 1 | set -eu 2 | 3 | install -d -m0755 -oroot -groot /etc/heka/conf.d/ 4 | install -m0744 -oroot -groot -T /usr/share/heka/examples/hekad.toml /etc/heka/conf.d/00-hekad.toml 5 | exit 0 6 | -------------------------------------------------------------------------------- /cmd/heka-sbmgr/sbmgr.toml: -------------------------------------------------------------------------------- 1 | ip_address = "127.0.0.1:5565" 2 | [signer] 3 | name = "test" 4 | hmac_hash = "md5" 5 | hmac_key = "4865ey9urgkidls xtb0[7lf9rzcivthkm" 6 | version = 0 7 | -------------------------------------------------------------------------------- /docs/source/sandbox/cookbook.rst: -------------------------------------------------------------------------------- 1 | .. _lua_sandbox_cookbook: 2 | 3 | Lua Sandbox Cookbooks 4 | ===================== 5 | * Decoders 6 | * :ref:`json_payload_transform` 7 | * Presentation 8 | * :ref:`graph_annotation` 9 | -------------------------------------------------------------------------------- /plugins/testsupport/config_bad_outputs.toml: -------------------------------------------------------------------------------- 1 | [udp_stats] 2 | type = "UdpInput" 3 | address = "127.0.0.1:29330" 4 | splitter = "HekaFramingSplitter" 5 | decoder = "ProtobufDecoder" 6 | 7 | [WhatOutput] 8 | type ="WhatOutput" 9 | -------------------------------------------------------------------------------- /plugins/testsupport/config_dir/two.toml: -------------------------------------------------------------------------------- 1 | [default] 2 | type ="StatFilter" 3 | message_matcher = "Type == \"mytype\"" 4 | 5 | [sample] 6 | type = "StatFilter" 7 | message_matcher = "Type == \"counter\" || Type == \"gauge\"" 8 | -------------------------------------------------------------------------------- /cmd/heka-sbmgrload/sbmgrload.toml: -------------------------------------------------------------------------------- 1 | ip_address = "127.0.0.1:5565" 2 | [signer] 3 | name = "test" 4 | hmac_hash = "md5" 5 | hmac_key = "4865ey9urgkidls xtb0[7lf9rzcivthkm" 6 | version = 0 7 | -------------------------------------------------------------------------------- /plugins/testsupport/config_env_test.toml: -------------------------------------------------------------------------------- 1 | [%ENV[LOG_ENCODER]] 2 | 3 | [LogOutput] 4 | type = "LogOutput" 5 | message_matcher = "TRUE" 6 | encoder = "%ENV[LOG_ENCODER]" 7 | 8 | [LogOutput.retries] 9 | max_retries = 0 10 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/inputs_index.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Name
10 | -------------------------------------------------------------------------------- /docs/source/sandbox/input.rst: -------------------------------------------------------------------------------- 1 | .. _sandboxinput: 2 | 3 | .. include:: ../config/inputs/sandbox.rst 4 | :start-line: 1 5 | 6 | .. _sandboxinputs: 7 | 8 | Available Sandbox Inputs 9 | ------------------------ 10 | 11 | - none 12 | -------------------------------------------------------------------------------- /pipeline/errors.go: -------------------------------------------------------------------------------- 1 | package pipeline 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | type TerminatedError string 8 | 9 | func (e TerminatedError) Error() string { 10 | return fmt.Sprintf("Terminated. Reason: %v", string(e)) 11 | } 12 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/channel_count_widget.mustache: -------------------------------------------------------------------------------- 1 |

{{Name}}

2 |

{{InChanLength.value}}/{{InChanCapacity.value}}

3 |
{{ChanDescription}}
4 | -------------------------------------------------------------------------------- /plugins/testsupport/config_bad_params.toml: -------------------------------------------------------------------------------- 1 | [UdpInput1] 2 | address = "127.0.0.1:29329" 3 | parser_type = "message.proto" 4 | decoder = "ProtobufDecoder" 5 | 6 | [ProtobufDecoder1] 7 | type = "ProtobufDecoder" 8 | 9 | [LogOutput1] 10 | type = "LogOutput" 11 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/serialize_noglobal.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | _G = nil 6 | -------------------------------------------------------------------------------- /docs/source/message/header.dot: -------------------------------------------------------------------------------- 1 | digraph header { 2 | node [shape=record, fontsize=10]; 3 | 4 | struct1 [label="Record Separator\n(byte=0x1E) \ 5 | |Header Length\n(byte) \ 6 | |Header\n(protocol buffer) \ 7 | |Unit Separator\n(byte=0x1F) \ 8 | |Message"]; 9 | } 10 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/multipack_decoder.lua: -------------------------------------------------------------------------------- 1 | function process_message () 2 | inject_payload("txt", "", "message one") 3 | inject_payload("txt", "", "message two") 4 | 5 | local hm = {Payload = "message three"} 6 | inject_message(hm) 7 | return 0 8 | end 9 | -------------------------------------------------------------------------------- /docker/build_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # verbose/exit on error 3 | set -xe 4 | docker build -t mozilla/heka_base .. 5 | docker build --rm -t mozilla/heka_build . 6 | docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -ti mozilla/heka_build 7 | docker rmi mozilla/heka_build 8 | -------------------------------------------------------------------------------- /packaging/debian/heka.postrm.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | USER="heka" 4 | GROUP="$USER" 5 | 6 | set -e 7 | 8 | #DEBHELPER# 9 | 10 | if [ "$1" = "purge" ] 11 | then 12 | update-rc.d heka remove 13 | deluser $USER 14 | rm -rf /var/cache/hekad 15 | rm -rf /etc/heka 16 | fi 17 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/hello_world.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | inject_payload("txt", "", "Hello World!") 6 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/serialize_failure.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | t = { [function(x) print(x) end] = "foo" } 6 | -------------------------------------------------------------------------------- /docs/source/config/encoders/alert.rst: -------------------------------------------------------------------------------- 1 | .. _config_alert_encoder: 2 | 3 | Alert Encoder 4 | ============= 5 | 6 | | Plugin Name: **SandboxEncoder** 7 | | File Name: **lua_encoders/alert.lua** 8 | 9 | .. include:: /../../sandbox/lua/encoders/alert.lua 10 | :start-after: --[[ 11 | :end-before: --]] 12 | -------------------------------------------------------------------------------- /plugins/testsupport/config_test_defaults.toml: -------------------------------------------------------------------------------- 1 | [UdpInput] 2 | address = "127.0.0.1:29329" 3 | splitter = "HekaFramingSplitter" 4 | decoder = "ProtobufDecoder" 5 | 6 | [LogOutput] 7 | 8 | [StatFilter] 9 | 10 | [sample] 11 | type = "StatFilter" 12 | message_matcher = "Type == 'counter' || Type == 'gauge'" 13 | -------------------------------------------------------------------------------- /plugins/testsupport/multiline.log: -------------------------------------------------------------------------------- 1 | 2012-07-13 18:48:01 debug readSocket() 2 | 2012-07-13 18:48:21 info Processing queue id 3496 -> subm id 2817 from site ms 3 | 2012-07-13 18:48:25 debug line0 4 | line1 5 | line2 6 | 2012-07-13 18:48:26 debug readSocket() 7 | 2012-07-13 18:48:26 debug Checking Queue... 8 | -------------------------------------------------------------------------------- /rpm/heka.preinst.in: -------------------------------------------------------------------------------- 1 | USER="heka" 2 | GROUP=$USER 3 | HOMEBASE=/var/cache/hekad 4 | 5 | getent group $GROUP >/dev/null || groupadd -r $GROUP 6 | getent passwd $USER >/dev/null || useradd -r -g $GROUP -M -d $HOMEBASE -s /sbin/nologin -c "heka daemon" $USER 7 | install -d -m0755 -o$USER -g$GROUP $HOMEBASE 8 | exit 0 9 | -------------------------------------------------------------------------------- /env.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set BUILD_DIR=%CD%\build 3 | set CTEST_OUTPUT_ON_FAILURE=1 4 | 5 | setlocal ENABLEDELAYEDEXPANSION 6 | set NEWGOPATH=%BUILD_DIR%\heka 7 | if NOT "%GOBIN%"=="" (set p=!PATH:%GOBIN%;=!) else (set p=!PATH!) 8 | endlocal & set GOPATH=%NEWGOPATH%& set GOBIN=%NEWGOPATH%\bin& set PATH=%p%;%NEWGOPATH%\bin; 9 | -------------------------------------------------------------------------------- /docs/source/config/decoders/json.rst: -------------------------------------------------------------------------------- 1 | .. _json_decoder: 2 | 3 | JSON Decoder 4 | ============ 5 | 6 | .. versionadded:: 0.10 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/json.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/json.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/globals_index.mustache: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/input.lua: -------------------------------------------------------------------------------- 1 | local msg = { 2 | Payload = nil 3 | } 4 | 5 | local cnt = 1 6 | 7 | function process_message() 8 | msg.Payload = "line " .. cnt 9 | cnt = cnt + 1 10 | if cnt == 3 then 11 | return -1, "failure message" 12 | end 13 | inject_message(msg) 14 | return 0 15 | end 16 | -------------------------------------------------------------------------------- /dasher/yuidoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Heka Dashboard", 3 | "description": "The Heka Dashboard monitors health and sandboxes.", 4 | "version": "0.4", 5 | "url": "https://github.com/mozilla-services/heka", 6 | "options": { 7 | "outdir": "docs", 8 | "paths": "javascript", 9 | "exclude": "javascript/vendor" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugins/testsupport/config_dir/one.toml: -------------------------------------------------------------------------------- 1 | [UdpInput] 2 | address = "127.0.0.1:29329" 3 | splitter = "HekaFramingSplitter" 4 | decoder = "ProtobufDecoder" 5 | 6 | [ProtobufDecoder] 7 | type = "ProtobufDecoder" 8 | 9 | [PayloadEncoder] 10 | 11 | [LogOutput] 12 | type = "LogOutput" 13 | message_matcher = "TRUE" 14 | encoder = "PayloadEncoder" 15 | -------------------------------------------------------------------------------- /docs/source/config/decoders/rsyslog.rst: -------------------------------------------------------------------------------- 1 | .. _config_rsyslog_decoder: 2 | 3 | Rsyslog Decoder 4 | =============== 5 | 6 | .. versionadded:: 0.5 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/rsyslog.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/rsyslog.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/encoders/espayload.rst: -------------------------------------------------------------------------------- 1 | .. _config_espayload: 2 | 3 | ElasticSearch Payload Encoder 4 | ============================= 5 | 6 | | Plugin Name: **SandboxEncoder** 7 | | File Name: **lua_encoders/es_payload.lua** 8 | 9 | .. include:: /../../sandbox/lua/encoders/es_payload.lua 10 | :start-after: --[[ 11 | :end-before: --]] 12 | -------------------------------------------------------------------------------- /docs/source/config/filters/cpu_stats.rst: -------------------------------------------------------------------------------- 1 | .. _config_cpu_stats_filter: 2 | 3 | CPU Stats Filter 4 | ================ 5 | 6 | .. versionadded:: 0.10 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/procstat.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/procstat.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/load_avg.rst: -------------------------------------------------------------------------------- 1 | .. _config_load_avg_filter: 2 | 3 | Load Average Filter 4 | =================== 5 | 6 | .. versionadded:: 0.7 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/loadavg.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/loadavg.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/stats_graph.rst: -------------------------------------------------------------------------------- 1 | .. _config_stats_graph_filter: 2 | 3 | Stats Graph 4 | =========== 5 | 6 | .. versionadded:: 0.7 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/stat_graph.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/stat_graph.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/unique_items.rst: -------------------------------------------------------------------------------- 1 | .. _config_unique_items_filter: 2 | 3 | Unique Items 4 | ============ 5 | 6 | .. versionadded:: 0.6 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/unique_items.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/unique_items.lua 12 | :start-after: --[[ 13 | :end-before: --]] -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go: 4 | - 1.4 5 | notifications: 6 | irc: 7 | channels: 8 | - "irc.mozilla.org#heka" 9 | addons: 10 | apt: 11 | packages: 12 | - protobuf-compiler 13 | - cmake 14 | - libgeoip-dev 15 | install: 16 | - . build.sh 17 | script: 18 | - make test 19 | -------------------------------------------------------------------------------- /docs/source/config/filters/disk_stats.rst: -------------------------------------------------------------------------------- 1 | .. _config_disk_stats_filter: 2 | 3 | Disk Stats Filter 4 | ================= 5 | 6 | .. versionadded:: 0.7 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/diskstats.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/diskstats.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/mem_stats.rst: -------------------------------------------------------------------------------- 1 | .. _config_mem_stats_filter: 2 | 3 | Memory Stats Filter 4 | =================== 5 | 6 | .. versionadded:: 0.7 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/memstats.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/memstats.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/encoder_writemessage.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message() 6 | write_message("Payload", "mutated payload") 7 | return 0 8 | end 9 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/encoder_raw.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message() 6 | inject_payload("json", "message_table", read_message("raw")) 7 | return 0 8 | end 9 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/read_raw.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message () 6 | if read_message("raw") then return -1, "should be nil" end 7 | return 0 8 | end 9 | -------------------------------------------------------------------------------- /dasher/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | // Documentation: http://www.jshint.com/docs/ 3 | "browser": true, 4 | "esnext": true, 5 | "globals": { 6 | "require": true, 7 | "console": true, 8 | "define": true 9 | }, 10 | "globalstrict": true, 11 | "quotmark": true, 12 | "smarttabs": true, 13 | "trailing": true, 14 | "undef": true, 15 | "unused": true 16 | } 17 | -------------------------------------------------------------------------------- /docs/source/config/filters/frequent_items.rst: -------------------------------------------------------------------------------- 1 | .. _config_frequent_items_filter: 2 | 3 | Frequent Items 4 | ============== 5 | 6 | .. versionadded:: 0.5 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/frequent_items.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/frequent_items.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/heka_memstat.rst: -------------------------------------------------------------------------------- 1 | .. _config_memstat_filter: 2 | 3 | Heka Memory Statistics 4 | ====================== 5 | 6 | .. versionadded:: 0.6 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/heka_memstat.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/heka_memstat.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/http_status.rst: -------------------------------------------------------------------------------- 1 | .. _config_http_status_graph_filter: 2 | 3 | HTTP Status Graph 4 | ================= 5 | 6 | .. versionadded:: 0.5 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/http_status.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/http_status.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.data text eol=lf 2 | multiline.log text eol=lf 3 | logstreamer/testdir/filehandling/2010/07/error.log text eol=lf 4 | logstreamer/testdir/filehandling/2010/07/error.log.2 text eol=lf 5 | logstreamer/testdir/filehandling/2013/08/access.log text eol=lf 6 | logstreamer/testdir/filehandling/2013/08/error.log text eol=lf 7 | logstreamer/testdir/shortlog/short.log text eol=lf 8 | -------------------------------------------------------------------------------- /docker/Dockerfile.final: -------------------------------------------------------------------------------- 1 | # heka image 2 | # installs heka from a deb package 3 | FROM debian:jessie 4 | MAINTAINER Chance Zibolski (@chance) 5 | 6 | COPY heka.deb /tmp/heka.deb 7 | RUN apt-get update && apt-get install -y libgeoip1 8 | RUN dpkg -i /tmp/heka.deb && rm /tmp/heka.deb 9 | 10 | EXPOSE 4352 11 | ENTRYPOINT ["hekad", "-config=/etc/heka/conf.d"] -------------------------------------------------------------------------------- /docs/source/config/encoders/cbuf_librato.rst: -------------------------------------------------------------------------------- 1 | .. _config_cbuf_librato_encoder: 2 | 3 | CBUF Librato Encoder 4 | ==================== 5 | 6 | .. versionadded:: 0.8 7 | 8 | | Plugin Name: **SandboxEncoder** 9 | | File Name: **lua_encoders/cbuf_librato.lua** 10 | 11 | .. include:: /../../sandbox/lua/encoders/cbuf_librato.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/influx_batch.rst: -------------------------------------------------------------------------------- 1 | .. _config_influx_batch_filter: 2 | 3 | InfluxDB Batch Filter 4 | ===================== 5 | 6 | .. versionadded:: 0.10 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/influx_batch.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/influx_batch.lua 12 | :start-after: --[=[ 13 | :end-before: --]=] 14 | -------------------------------------------------------------------------------- /docs/source/config/decoders/linux_netdev.rst: -------------------------------------------------------------------------------- 1 | .. _config_linux_netdev_decoder: 2 | 3 | Linux netdev Decoder 4 | ==================== 5 | 6 | .. versionadded:: 0.10 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/linux_netdev.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/linux_netdev.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/mysql_slow_query.rst: -------------------------------------------------------------------------------- 1 | .. _config_mysql_slow_query_filter: 2 | 3 | MySQL Slow Query 4 | ================ 5 | 6 | .. versionadded:: 0.6 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/mysql_slow_query.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/mysql_slow_query.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/decoders/linux_netstat.rst: -------------------------------------------------------------------------------- 1 | .. _config_linux_netstat_decoder: 2 | 3 | Linux netstat Decoder 4 | ===================== 5 | 6 | .. versionadded:: 0.10 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/linux_netstat.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/linux_netstat.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/decoders/nginx_error.rst: -------------------------------------------------------------------------------- 1 | .. _config_nginx_error_log_decoder: 2 | 3 | Nginx Error Log Decoder 4 | ======================= 5 | 6 | .. versionadded:: 0.6 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/nginx_error.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/nginx_error.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/encoders/schema_influx.rst: -------------------------------------------------------------------------------- 1 | .. _config_schema_influx_encoder: 2 | 3 | Schema InfluxDB Encoder 4 | ======================= 5 | 6 | .. versionadded:: 0.8 7 | 8 | | Plugin Name: **SandboxEncoder** 9 | | File Name: **lua_encoders/schema_influx.lua** 10 | 11 | .. include:: /../../sandbox/lua/encoders/schema_influx.lua 12 | :start-after: --[=[ 13 | :end-before: --]=] 14 | -------------------------------------------------------------------------------- /docs/source/config/decoders/nginx_access.rst: -------------------------------------------------------------------------------- 1 | .. _config_nginx_access_log_decoder: 2 | 3 | Nginx Access Log Decoder 4 | ======================== 5 | 6 | .. versionadded:: 0.5 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/nginx_access.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/nginx_access.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/message_schema.rst: -------------------------------------------------------------------------------- 1 | .. _config_message_schema_filter: 2 | 3 | Heka Message Schema 4 | =================== 5 | 6 | .. versionadded:: 0.5 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/heka_message_schema.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/heka_message_schema.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /plugins/http/http_util.go: -------------------------------------------------------------------------------- 1 | package http 2 | 3 | import "net/http" 4 | 5 | func CustomHeadersHandler(h http.Handler, header http.Header) http.Handler { 6 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 7 | for key, vals := range header { 8 | for _, val := range vals { 9 | w.Header().Add(key, val) 10 | } 11 | } 12 | h.ServeHTTP(w, r) 13 | }) 14 | } 15 | -------------------------------------------------------------------------------- /plugins/testsupport/config_test_common.toml: -------------------------------------------------------------------------------- 1 | [UdpInput] 2 | address = "127.0.0.1:5565" 3 | splitter = "HekaFramingSplitter" 4 | decoder = "ProtobufDecoder" 5 | 6 | [UdpInput.retries] 7 | max_delay = "30s" 8 | delay = "250ms" 9 | max_retries = 5 10 | 11 | [CounterFilter] 12 | message_matcher = "Type != 'heka.counter-output'" 13 | message_signer = "some_signer" 14 | ticker_interval = 10 15 | 16 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/readint.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message () 6 | local i = read_message("Pid") 7 | return 0 8 | end 9 | 10 | function timer_event() 11 | end 12 | 13 | -------------------------------------------------------------------------------- /docs/source/config/decoders/apache_access.rst: -------------------------------------------------------------------------------- 1 | .. _config_apache_access_log_decoder: 2 | 3 | Apache Access Log Decoder 4 | ========================= 5 | 6 | .. versionadded:: 0.6 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/apache_access.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/apache_access.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/decoders/linux_cpu_stats.rst: -------------------------------------------------------------------------------- 1 | .. _config_linux_cpu_stats_decoder: 2 | 3 | Linux CPU Stats Decoder 4 | ======================= 5 | 6 | .. versionadded:: 0.10 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/linux_procstat.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/linux_procstat.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/decoders/linux_load_avg.rst: -------------------------------------------------------------------------------- 1 | .. _config_linux_load_avg_decoder: 2 | 3 | Linux Load Average Decoder 4 | ========================== 5 | 6 | .. versionadded:: 0.7 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/linux_loadavg.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/linux_loadavg.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/decoders/linux_mem_stats.rst: -------------------------------------------------------------------------------- 1 | .. _config_linux_mem_stats_decoder: 2 | 3 | Linux Memory Stats Decoder 4 | ========================== 5 | 6 | .. versionadded:: 0.7 7 | 8 | Plugin Name: **SandboxDecoder** 9 | File Name: **lua_decoders/linux_memstats.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/linux_memstats.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/decoders/linux_disk_stats.rst: -------------------------------------------------------------------------------- 1 | .. _config_linux_disk_stats_decoder: 2 | 3 | Linux Disk Stats Decoder 4 | ======================== 5 | 6 | .. versionadded:: 0.7 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/linux_diskstats.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/linux_diskstats.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/decoders/nginx_stub_status.rst: -------------------------------------------------------------------------------- 1 | .. _nginx_stub_status_decoder: 2 | 3 | Nginx Stub Status Decoder 4 | ========================= 5 | 6 | .. versionadded:: 0.10 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/nginx_stub_status.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/nginx_stub_status.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/encoders/statmetric_influx.rst: -------------------------------------------------------------------------------- 1 | .. _config_statmetric_influx: 2 | 3 | StatMetric InfluxDB Encoder 4 | =========================== 5 | 6 | .. versionadded:: 0.7 7 | 8 | | Plugin Name: **SandboxEncoder** 9 | | File Name: **lua_encoders/statmetric_influx.lua** 10 | 11 | .. include:: /../../sandbox/lua/encoders/statmetric_influx.lua 12 | :start-after: --[=[ 13 | :end-before: --]=] 14 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/readfield.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message () 6 | local s = read_message("Fields[foo]") 7 | return 0 8 | end 9 | 10 | function timer_event() 11 | end 12 | 13 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/encoders_index.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
NameProcess FailuresProcess DurationProcessed
13 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/readstring.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message () 6 | local s = read_message("Type") 7 | return 0 8 | end 9 | 10 | 11 | function timer_event() 12 | end 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/source/config/encoders/schema_carbon_line.rst: -------------------------------------------------------------------------------- 1 | .. _config_schema_carbon_line_encoder: 2 | 3 | Schema Carbon Line Encoder 4 | ========================== 5 | 6 | .. versionadded:: 0.10 7 | 8 | | Plugin Name: **SandboxEncoder** 9 | | File Name: **lua_encoders/schema_carbon_line.lua** 10 | 11 | .. include:: /../../sandbox/lua/encoders/schema_carbon_line.lua 12 | :start-after: --[=[ 13 | :end-before: --]=] 14 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/cjson.lua: -------------------------------------------------------------------------------- 1 | local cj = require("cjson") 2 | 3 | function process_message() 4 | if cj ~= cjson then 5 | return 1 6 | end 7 | 8 | local payload = read_message("Payload") 9 | local value = cjson.decode(payload) 10 | if "bar" ~= value[2].foo then 11 | return 2 12 | end 13 | 14 | return 0 15 | end 16 | 17 | function timer_event(ns) 18 | 19 | end 20 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/loop.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message () 6 | inject_payload("txt", "", "loop to self") 7 | return 0 8 | end 9 | 10 | 11 | function timer_event(ns) 12 | end 13 | 14 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/process_message_error_string.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message () 6 | return -1, "script provided error message" 7 | end 8 | 9 | function timer_event(ns) 10 | end 11 | 12 | -------------------------------------------------------------------------------- /docs/source/config/decoders/mysql_slow_query.rst: -------------------------------------------------------------------------------- 1 | .. _config_mysql_slow_query_log_decoder: 2 | 3 | MySQL Slow Query Log Decoder 4 | ============================ 5 | 6 | .. versionadded:: 0.6 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/mysql_slow_query.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/mysql_slow_query.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/encoders/schema_influx_line.rst: -------------------------------------------------------------------------------- 1 | .. _config_schema_influx_line_encoder: 2 | 3 | Schema InfluxDB Line Encoder 4 | ============================ 5 | 6 | .. versionadded:: 0.10 7 | 8 | | Plugin Name: **SandboxEncoder** 9 | | File Name: **lua_encoders/schema_influx_line.lua** 10 | 11 | .. include:: /../../sandbox/lua/encoders/schema_influx_line.lua 12 | :start-after: --[=[ 13 | :end-before: --]=] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/cbuf_delta.rst: -------------------------------------------------------------------------------- 1 | .. _config_circular_buffer_delta_agg_filter: 2 | 3 | Circular Buffer Delta Aggregator 4 | ================================ 5 | 6 | .. versionadded:: 0.5 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/cbufd_aggregator.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/cbufd_aggregator.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/subdir/file.log.1: -------------------------------------------------------------------------------- 1 | 10.1.1.4 plinko-565.byzantium.mozilla.com user3 [15/Mar/2013:12:20:27 -0700] "GET /1.1/user3/storage/passwords?newer=1356237662.44&full=1 HTTP/1.1" 200 1396 "-" "Firefox/20.0.1 FxSync/1.22.0.201304.desktop" "-" "ssl: SSL_RSA_WITH_RC4_128_SHA, version=TLSv1, bits=128" node_s:0.047167 req_s:0.047167 retries:0 req_b:446 "c_l:-" 2 | 10.1.1.4 plinko-565.byzantium.mozilla.com user3 3 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/encoder_text.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | local result 6 | 7 | function process_message() 8 | result = "Prefixed " .. read_message("Payload") 9 | inject_payload("txt", "", result) 10 | return 0 11 | end 12 | -------------------------------------------------------------------------------- /docs/source/config/decoders/graylog_extended.rst: -------------------------------------------------------------------------------- 1 | .. _config_graylog_extended_log_format_decoder: 2 | 3 | Graylog Extended Log Format Decoder 4 | =================================== 5 | 6 | .. versionadded:: 0.8 7 | 8 | | Plugin Name: **SandboxDecoder** 9 | | File Name: **lua_decoders/graylog_extended.lua** 10 | 11 | .. include:: /../../sandbox/lua/decoders/graylog_extended.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /docs/source/config/filters/cbuf_delta_by_host.rst: -------------------------------------------------------------------------------- 1 | .. _config_circular_buffer_delta_agg_by_host: 2 | 3 | CBuf Delta Aggregator By Hostname 4 | ================================= 5 | 6 | .. versionadded:: 0.5 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/cbufd_host_aggregatory.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/cbufd_host_aggregator.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/backpressure.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message () 6 | for i=1,200000 do 7 | read_message("Payload") 8 | end 9 | return 0 10 | end 11 | 12 | function timer_event(ns) 13 | end 14 | 15 | -------------------------------------------------------------------------------- /docs/source/config/filters/message_failures.rst: -------------------------------------------------------------------------------- 1 | .. _config_process_message_failures_filter: 2 | 3 | Heka Process Message Failures 4 | ============================= 5 | 6 | .. versionadded:: 0.7 7 | 8 | | Plugin Name: **SandboxFilter** 9 | | File Name: **lua_filters/heka_process_message_failures.lua** 10 | 11 | .. include:: /../../sandbox/lua/filters/heka_process_message_failures.lua 12 | :start-after: --[[ 13 | :end-before: --]] 14 | -------------------------------------------------------------------------------- /cmake/message_proto.cmake: -------------------------------------------------------------------------------- 1 | if(NOT PROTOBUF_EXECUTABLE) 2 | message(FATAL_ERROR "Google protocol buffers 'protoc' must be installed, message.proto has been modified and needs to be regenerated.") 3 | endif() 4 | 5 | execute_process( 6 | COMMAND ${PROTOBUF_EXECUTABLE} --gogo_out=. -I=.:../build/heka/src/github.com/gogo/protobuf/gogoproto:../build/heka/src/github.com/gogo/protobuf/protobuf message.proto 7 | WORKING_DIRECTORY "${SRC_DIR}/message" 8 | ) 9 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/encoders_row.mustache: -------------------------------------------------------------------------------- 1 | {{Name}} 2 | {{ProcessMessageFailuresFormatted}} 3 | {{ProcessMessageAvgDurationFormatted}} {{ProcessMessageAvgDuration.representation}} 4 | {{ProcessMessageCountFormatted}} 5 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/read_config_nil.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | local s = read_config("string") 6 | if s ~= nil then error("string") end 7 | 8 | function process_message () 9 | return 0 10 | end 11 | 12 | function timer_event() 13 | end 14 | 15 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/simple_count.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | count = 0 6 | 7 | function process_message () 8 | count = count + 1 9 | inject_payload("txt", "", count) 10 | return 0 11 | end 12 | 13 | function timer_event(ns) 14 | end 15 | 16 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/timerinject.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | 6 | function process_message () 7 | return 0 8 | end 9 | 10 | 11 | function timer_event(ns) 12 | for i = 1, 11 do 13 | inject_payload("txt", "", "test") 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /packaging/debian/heka.postinst.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | set -eu 4 | USER="heka" 5 | GROUP="$USER" 6 | 7 | if [ ! -d /etc/heka/conf.d/ ] 8 | then 9 | mkdir -p /etc/heka/conf.d/ 10 | cp /usr/share/heka/examples/hekad.toml /etc/heka/conf.d/00-hekad.toml 11 | fi 12 | 13 | if [ ! -d /usr/share/doc/heka/ ] 14 | then 15 | mkdir -p /usr/share/doc/heka 16 | ln -s /usr/share/heka/examples /usr/share/doc/heka/examples 17 | fi 18 | 19 | #DEBHELPER# 20 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/processinject.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | 6 | function process_message () 7 | for i = 1, 2 do 8 | inject_payload("txt", "", "test") 9 | end 10 | return 0 11 | end 12 | 13 | 14 | function timer_event(ns) 15 | end 16 | 17 | -------------------------------------------------------------------------------- /docs/source/sandbox/output.rst: -------------------------------------------------------------------------------- 1 | .. _sandboxoutput: 2 | 3 | .. include:: ../config/outputs/sandbox.rst 4 | :start-line: 1 5 | 6 | .. _sandboxoutputs: 7 | 8 | Available Sandbox Outputs 9 | ------------------------- 10 | - none 11 | 12 | Externally Available Sandbox Outputs 13 | ------------------------------------ 14 | 15 | - `Example Redshift Output `_ 16 | 17 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/decoders_index.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
NameProcess FailuresProcess DurationProcessed
14 | -------------------------------------------------------------------------------- /env.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # if the environment has been setup before clean it up 4 | if [ $GOBIN ]; then 5 | PATH=$(echo $PATH | sed -e "s;\(^$GOBIN:\|:$GOBIN$\|:$GOBIN\(:\)\);\2;g") 6 | fi 7 | 8 | BUILD_DIR=$PWD/build 9 | export CTEST_OUTPUT_ON_FAILURE=1 10 | export GOPATH=$BUILD_DIR/heka 11 | export LD_LIBRARY_PATH=$BUILD_DIR/heka/lib 12 | export DYLD_LIBRARY_PATH=$BUILD_DIR/heka/lib 13 | export GOBIN=$GOPATH/bin 14 | export PATH=$GOBIN:$PATH 15 | 16 | -------------------------------------------------------------------------------- /docs/source/config/outputs/log.rst: -------------------------------------------------------------------------------- 1 | .. _config_log_output: 2 | 3 | Log Output 4 | ========== 5 | 6 | Plugin Name: **LogOutput** 7 | 8 | Logs messages to stdout using Go's `log` package. Honors hekad's global 9 | ``log_flags`` setting. 10 | 11 | Config: 12 | 13 | 14 | 15 | Example: 16 | 17 | .. code-block:: ini 18 | 19 | [counter_output] 20 | type = "LogOutput" 21 | message_matcher = "Type == 'heka.counter-output'" 22 | encoder = "PayloadEncoder" 23 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/filters_index.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Name
14 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/outputs_index.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Name
14 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/health_index.mustache: -------------------------------------------------------------------------------- 1 |

Health

2 | 3 |
4 |
5 |
6 | 7 |

Inputs

8 |
9 | 10 |

Decoders

11 |
12 | 13 |

Filters

14 |
15 | 16 |

Outputs

17 |
18 | 19 |

Encoders

20 |
21 | -------------------------------------------------------------------------------- /docs/source/config/encoders/index.rst: -------------------------------------------------------------------------------- 1 | .. _config_encoders: 2 | 3 | ======== 4 | Encoders 5 | ======== 6 | 7 | .. versionadded:: 0.6 8 | 9 | Available Encoder Plugins 10 | ========================= 11 | 12 | .. toctree:: 13 | :maxdepth: 1 14 | 15 | alert 16 | cbuf_librato 17 | esjson 18 | eslogstashv0 19 | espayload 20 | payload 21 | protobuf 22 | rst 23 | sandbox 24 | schema_carbon_line 25 | schema_influx 26 | schema_influx_line 27 | statmetric_influx 28 | -------------------------------------------------------------------------------- /packaging/debian/heka.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=heka - data collector and processor daemon 3 | After=network.target auditd.service 4 | ConditionPathExists=!/etc/heka/hekad_not_to_be_run 5 | 6 | [Service] 7 | EnvironmentFile=-/etc/default/heka 8 | User=heka 9 | Group=heka 10 | ExecStart=/usr/bin/hekad -config=/etc/heka/conf.d/ 11 | ExecReload=/bin/kill -HUP $MAINPID 12 | KillMode=process 13 | Restart=on-failure 14 | StandardError=inherit 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /plugins/testsupport/config_test.toml: -------------------------------------------------------------------------------- 1 | [UdpInput] 2 | address = "127.0.0.1:29329" 3 | splitter = "HekaFramingSplitter" 4 | decoder = "ProtobufDecoder" 5 | 6 | [ProtobufDecoder] 7 | 8 | [PayloadEncoder] 9 | 10 | [LogOutput] 11 | type = "LogOutput" 12 | message_matcher = "TRUE" 13 | encoder = "PayloadEncoder" 14 | 15 | [default] 16 | type ="StatFilter" 17 | message_matcher = "Type == \"mytype\"" 18 | 19 | [sample] 20 | type = "StatFilter" 21 | message_matcher = "Type == \"counter\" || Type == \"gauge\"" 22 | -------------------------------------------------------------------------------- /docs/source/sandbox/graph_annotation.rst: -------------------------------------------------------------------------------- 1 | .. _graph_annotation: 2 | 3 | Circular Buffer Graph Annotation (Alerts) 4 | ========================================= 5 | This plugin detects anomalies in the data. When an anomaly is detected an 6 | alert is generated and the graph is visually annotated at the time of the 7 | alert. See `dygraphs Annotations `_ 8 | for the available annotation properties. 9 | 10 | .. literalinclude:: ../../../sandbox/lua/filters/cbufd_aggregator.lua 11 | :language: lua 12 | -------------------------------------------------------------------------------- /docs/source/man/plugin.rst: -------------------------------------------------------------------------------- 1 | ===== 2 | hekad 3 | ===== 4 | 5 | Description 6 | =========== 7 | 8 | Available hekad plugins compiled with this version of hekad. 9 | 10 | .. include:: /config/inputs/index_noref.rst 11 | 12 | .. include:: /config/splitters/index_noref.rst 13 | 14 | .. include:: /config/decoders/index_noref.rst 15 | 16 | .. include:: /config/filters/index_noref.rst 17 | 18 | .. include:: /config/encoders/index_noref.rst 19 | 20 | .. include:: /config/outputs/index_noref.rst 21 | 22 | See Also 23 | ======== 24 | 25 | hekad(1), hekad.config(5) -------------------------------------------------------------------------------- /examples/example.toml: -------------------------------------------------------------------------------- 1 | [TcpInput] 2 | address = "127.0.0.1:5565" 3 | parser_type = "message.proto" 4 | decoder = "ProtobufDecoder" 5 | 6 | [HostFilter] 7 | message_matcher = "Type != 'heka.counter-output'" 8 | hosts = ["127.0.0.1", "grail"] 9 | output = "UdpOutput" 10 | 11 | [CounterFilter] 12 | message_matcher = "Type != 'heka.counter-output'" 13 | ticker_interval = 1 14 | 15 | [UdpOutput] 16 | address = "127.0.0.1:6676" 17 | 18 | [LogOutput] 19 | message_matcher = "Type == 'heka.counter-output' || Type == 'heka.all-report'" 20 | payload_only = true 21 | 22 | -------------------------------------------------------------------------------- /docs/source/config/splitters/index_noref.rst: -------------------------------------------------------------------------------- 1 | 2 | .. versionadded:: 0.9 3 | 4 | ========= 5 | Splitters 6 | ========= 7 | 8 | .. include:: /config/splitters/index.rst 9 | :start-after: _config_common_splitter_parameters 10 | :end-before: Available Splitter Plugins 11 | 12 | .. include:: /config/splitters/heka_framing.rst 13 | :start-line: 1 14 | 15 | .. include:: /config/splitters/null.rst 16 | :start-line: 1 17 | 18 | .. include:: /config/splitters/regex.rst 19 | :start-line: 1 20 | 21 | .. include:: /config/splitters/token.rst 22 | :start-line: 1 23 | -------------------------------------------------------------------------------- /cmake/CMakeDebHelperInstall.cmake: -------------------------------------------------------------------------------- 1 | # This script is used internally by CMakeDebHelper. 2 | # It is run at CPack-Time and copies the files generated by the debhelpers to the right place. 3 | 4 | if( NOT CPACK_DEBIAN_PACKAGE_NAME ) 5 | string( TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME ) 6 | endif() 7 | 8 | # Copy all generated files where the packing will happen, 9 | # exclude the DEBIAN-directory. 10 | file( COPY 11 | "${CPACK_OUTPUT_FILE_PREFIX}/packaging/debian/${CPACK_DEBIAN_PACKAGE_NAME}/" 12 | DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" 13 | PATTERN DEBIAN EXCLUDE 14 | ) 15 | -------------------------------------------------------------------------------- /docs/source/config/decoders/sandbox.rst: -------------------------------------------------------------------------------- 1 | .. _config_sandboxdecoder: 2 | 3 | Sandbox Decoder 4 | =============== 5 | 6 | Plugin Name: **SandboxDecoder** 7 | 8 | The SandboxDecoder provides an isolated execution environment for data parsing 9 | and complex transformations without the need to recompile Heka. See 10 | :ref:`sandbox`. 11 | 12 | .. _sandboxdecoder_settings: 13 | 14 | Config: 15 | 16 | - :ref:`config_common_sandbox_parameters` 17 | 18 | Example 19 | 20 | .. code-block:: ini 21 | 22 | [sql_decoder] 23 | type = "SandboxDecoder" 24 | filename = "sql_decoder.lua" 25 | 26 | -------------------------------------------------------------------------------- /docs/source/man/usage.rst: -------------------------------------------------------------------------------- 1 | .. _hekad_cli: 2 | 3 | ===== 4 | hekad 5 | ===== 6 | 7 | Synopsis 8 | ======== 9 | 10 | hekad [``-version``] [``-config`` `config_file`] 11 | 12 | Description 13 | =========== 14 | 15 | .. include:: /index.rst 16 | :start-after: start-description 17 | :end-before: end-description 18 | 19 | Options 20 | ======= 21 | 22 | .. include:: /index.rst 23 | :start-after: start-options 24 | :end-before: end-options 25 | 26 | Files 27 | ===== 28 | 29 | /etc/hekad.toml configuration file 30 | 31 | See Also 32 | ======== 33 | 34 | hekad.config(5), hekad.plugin(5) 35 | -------------------------------------------------------------------------------- /docs/source/config/encoders/rst.rst: -------------------------------------------------------------------------------- 1 | .. _config_rstencoder: 2 | 3 | Restructured Text Encoder 4 | ========================= 5 | 6 | Plugin Name: **RstEncoder** 7 | 8 | The RstEncoder generates a `reStructuredText 9 | `_ rendering of a Heka message, 10 | including all fields and attributes. It is useful for debugging, especially 11 | when coupled with a :ref:`config_log_output`. 12 | 13 | Config: 14 | 15 | 16 | 17 | Example: 18 | 19 | .. code-block:: ini 20 | 21 | [RstEncoder] 22 | 23 | [LogOutput] 24 | message_matcher = "TRUE" 25 | encoder = "RstEncoder" 26 | -------------------------------------------------------------------------------- /docs/source/config/decoders/index.rst: -------------------------------------------------------------------------------- 1 | .. _config_decoders: 2 | 3 | ======== 4 | Decoders 5 | ======== 6 | 7 | Available Decoder Plugins 8 | ========================= 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | 13 | apache_access 14 | geoip 15 | graylog_extended 16 | json 17 | linux_cpu_stats 18 | linux_disk_stats 19 | linux_load_avg 20 | linux_mem_stats 21 | linux_netdev 22 | linux_netstat 23 | multi 24 | mysql_slow_query 25 | nginx_access 26 | nginx_error 27 | nginx_stub_status 28 | payload_regex 29 | payload_xml 30 | protobuf 31 | rsyslog 32 | sandbox 33 | scribble 34 | stats_to_fields 35 | -------------------------------------------------------------------------------- /CPackConfig.cmake: -------------------------------------------------------------------------------- 1 | # See http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29 2 | 3 | if(CPACK_GENERATOR MATCHES "DEB") 4 | set(CPACK_DEBIAN_PACKAGE_VERSION_SUFFIX "$ENV{CPACK_DEBIAN_PACKAGE_VERSION_SUFFIX}") 5 | set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${CPACK_DEBIAN_PACKAGE_VERSION_SUFFIX}") 6 | set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") 7 | # When the DEB-generator runs, we want him to run our install-script 8 | set(CPACK_INSTALL_SCRIPT ${CPACK_DEBIAN_INSTALL_SCRIPT}) 9 | endif() 10 | -------------------------------------------------------------------------------- /docs/source/man/config.rst: -------------------------------------------------------------------------------- 1 | ===== 2 | hekad 3 | ===== 4 | 5 | Description 6 | =========== 7 | 8 | .. include:: /config/index.rst 9 | :start-after: start-hekad-config 10 | :end-before: end-hekad-config 11 | 12 | Full documentation on available plugins and settings for each one are 13 | in the hekad.plugin(5) pages. 14 | 15 | Example hekad.toml File 16 | ======================= 17 | 18 | .. include:: /config/index.rst 19 | :start-after: start-hekad-toml 20 | :end-before: end-hekad-toml 21 | 22 | .. include:: /config/index.rst 23 | :start-after: _configuring_restarting: 24 | :end-before: end-restarting 25 | 26 | See Also 27 | ======== 28 | 29 | hekad(1), hekad.plugin(5) 30 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | # This Source Code Form is subject to the terms of the Mozilla Public 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 | # You can obtain one at http://mozilla.org/MPL/2.0/. 4 | # 5 | # The Initial Developer of the Original Code is the Mozilla Foundation. 6 | # Portions created by the Initial Developer are Copyright (C) 2012 7 | # the Initial Developer. All Rights Reserved. 8 | # 9 | # Contributor(s): 10 | # Ben Bangert (bbangert@mozilla.com) 11 | # Mike Trinkala (mtrinkala@mozilla.com) 12 | # Rob Miller (rmiller@mozilla.com) 13 | # Victor Ng (vng@mozilla.com) 14 | # David Birdsong (david@imgix.com) 15 | # Michael Gibson (michael.gibson79@gmail.com) 16 | -------------------------------------------------------------------------------- /docs/source/config/encoders/sandbox.rst: -------------------------------------------------------------------------------- 1 | .. _config_sandboxencoder: 2 | 3 | Sandbox Encoder 4 | =============== 5 | 6 | Plugin Name: **SandboxEncoder** 7 | 8 | The SandboxEncoder provides an isolated execution environment for converting 9 | messages into binary data without the need to recompile Heka. See 10 | :ref:`sandbox`. 11 | 12 | .. _sandboxencoder_settings: 13 | 14 | Config: 15 | 16 | - :ref:`config_common_sandbox_parameters` 17 | 18 | Example 19 | 20 | .. code-block:: ini 21 | 22 | [custom_json_encoder] 23 | type = "SandboxEncoder" 24 | filename = "path/to/custom_json_encoder.lua" 25 | 26 | [custom_json_encoder.config] 27 | msg_fields = ["field1", "field2"] 28 | -------------------------------------------------------------------------------- /docs/source/sandbox/json_payload_transform.rst: -------------------------------------------------------------------------------- 1 | .. _json_payload_transform: 2 | 3 | JSON Payload Transform 4 | ====================== 5 | Alters a date/time string in the JSON payload to be RFC3339 compliant. 6 | In this example the JSON is parsed, transformed and re-injected into the payload. 7 | 8 | .. literalinclude:: ../../../sandbox/lua/testsupport/json_payload_transform.lua 9 | :language: lua 10 | 11 | Alters a date/time string in the JSON payload to be RFC3339 compliant. 12 | In this example a search and replace is performed on the JSON text and 13 | re-injected into the payload. 14 | 15 | .. literalinclude:: ../../../sandbox/lua/testsupport/json_payload_transform_sr.lua 16 | :language: lua 17 | -------------------------------------------------------------------------------- /pipeline/pipeline_signals_darwin.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Victor Ng (vng@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package pipeline 16 | 17 | import "syscall" 18 | 19 | const SIGUSR1 = syscall.SIGUSR1 20 | const SIGUSR2 = syscall.SIGUSR2 21 | -------------------------------------------------------------------------------- /pipeline/pipeline_signals_linux.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Victor Ng (vng@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package pipeline 16 | 17 | import "syscall" 18 | 19 | const SIGUSR1 = syscall.SIGUSR1 20 | const SIGUSR2 = syscall.SIGUSR2 21 | -------------------------------------------------------------------------------- /pipeline/pipeline_signals_freebsd.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Victor Ng (vng@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package pipeline 16 | 17 | import "syscall" 18 | 19 | const SIGUSR1 = syscall.SIGUSR1 20 | const SIGUSR2 = syscall.SIGUSR2 21 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/encoder_protobuf.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | local msg = { 6 | Timestamp = nil, 7 | Hostname = nil, 8 | Payload = "mutated", 9 | Type = "after", 10 | Pid = nil, 11 | Severity = nil, 12 | Fields = nil 13 | } 14 | 15 | function process_message() 16 | msg.Timestamp = read_message("Timestamp") 17 | msg.Hostname = read_message("Hostname") 18 | msg.Pid = read_message("Pid") 19 | msg.Severity = read_message("Severity") 20 | inject_message(msg) 21 | return 0 22 | end 23 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/output.lua: -------------------------------------------------------------------------------- 1 | require "io" 2 | require "string" 3 | require "dummy" 4 | 5 | function process_message() 6 | local payload = read_message("Payload") 7 | if string.find(payload, "^FAILURE") then 8 | return -1, "failure message" 9 | elseif string.find(payload, "^USERABORT") then 10 | return 1, "user abort" 11 | elseif string.find(payload, "^FATAL") then 12 | error("fatal error") 13 | else 14 | local fh = io.open("output.lua.txt", "w+") 15 | io.output(fh) 16 | io.write(read_message("Payload")) 17 | io.close() 18 | end 19 | return 0 20 | end 21 | 22 | function timer_event(ns) 23 | error("fatal error timer_event") 24 | end 25 | 26 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/plugins_show.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "presenters/plugin_presenter", 5 | "hgn!templates/health/plugins_show" 6 | ], 7 | function(BaseView, PluginPresenter, PluginsShowTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Show view for plugins. 12 | * 13 | * @class PluginsShow 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var PluginsShow = BaseView.extend({ 19 | presenter: PluginPresenter, 20 | template: PluginsShowTemplate, 21 | 22 | initialize: function() { 23 | this.listenTo(this.model, "change", this.render, this); 24 | } 25 | }); 26 | 27 | return PluginsShow; 28 | } 29 | ); 30 | -------------------------------------------------------------------------------- /dasher/javascript/templates/sandboxes/sandbox_output_txt_show.mustache: -------------------------------------------------------------------------------- 1 |

{{SandboxName}}

2 |
3 |
4 |

{{Name}}{{^Name}}[Untitled]{{/Name}}

5 |
6 |
7 |
8 | Embed 9 | Raw 10 |
11 |
12 |
13 |
{{data}}
14 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/inputs_row.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "presenters/plugin_presenter", 5 | "hgn!templates/health/inputs_row" 6 | ], 7 | function(BaseView, PluginPresenter, InputsRowTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Row view for input plugins. 12 | * 13 | * @class InputsRow 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var InputsRow = BaseView.extend({ 19 | tagName: "tr", 20 | presenter: PluginPresenter, 21 | template: InputsRowTemplate, 22 | 23 | initialize: function() { 24 | this.listenTo(this.model, "change", this.render, this); 25 | } 26 | }); 27 | 28 | return InputsRow; 29 | } 30 | ); 31 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # heka_base image 2 | FROM golang:1.4 3 | 4 | MAINTAINER Chance Zibolski (@chance) 5 | 6 | RUN apt-get update && \ 7 | apt-get install -yq --no-install-recommends \ 8 | build-essential \ 9 | bzr \ 10 | ca-certificates \ 11 | cmake \ 12 | curl \ 13 | git \ 14 | golang-goprotobuf-dev\ 15 | make \ 16 | mercurial \ 17 | patch \ 18 | ruby-dev \ 19 | protobuf-compiler \ 20 | python-sphinx \ 21 | wget \ 22 | debhelper \ 23 | fakeroot \ 24 | libgeoip-dev \ 25 | libgeoip1 \ 26 | golang-goprotobuf-dev 27 | 28 | WORKDIR /heka 29 | 30 | EXPOSE 4352 31 | 32 | COPY . /heka 33 | -------------------------------------------------------------------------------- /dasher/javascript/templates/termination_report/termination_report_index.mustache: -------------------------------------------------------------------------------- 1 |

Termination Report

2 | 3 | {{#collection.length}} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {{#collection}} 12 | 13 | 14 | 15 | 16 | 17 | {{/collection}} 18 | 19 |
DatePluginMessage
{{formattedTime}}{{plugin}}{{message}}
20 | {{/collection.length}} 21 | 22 | {{^collection.length}} 23 |
No plugins have been terminated
24 | {{/collection.length}} 25 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/filters_row.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "presenters/plugin_presenter", 5 | "hgn!templates/health/filters_row" 6 | ], 7 | function(BaseView, PluginPresenter, FiltersRowTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Row view for filter plugins. 12 | * 13 | * @class FiltersRow 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var FiltersRow = BaseView.extend({ 19 | tagName: "tr", 20 | presenter: PluginPresenter, 21 | template: FiltersRowTemplate, 22 | 23 | initialize: function() { 24 | this.listenTo(this.model, "change", this.render, this); 25 | } 26 | }); 27 | 28 | return FiltersRow; 29 | } 30 | ); 31 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/outputs_row.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "presenters/plugin_presenter", 5 | "hgn!templates/health/outputs_row" 6 | ], 7 | function(BaseView, PluginPresenter, OutputsRowTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Row view for output plugins. 12 | * 13 | * @class OutputsRow 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var OutputsRow = BaseView.extend({ 19 | tagName: "tr", 20 | presenter: PluginPresenter, 21 | template: OutputsRowTemplate, 22 | 23 | initialize: function() { 24 | this.listenTo(this.model, "change", this.render, this); 25 | } 26 | }); 27 | 28 | return OutputsRow; 29 | } 30 | ); 31 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/decoders_row.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "presenters/plugin_presenter", 5 | "hgn!templates/health/decoders_row" 6 | ], 7 | function(BaseView, PluginPresenter, DecodersRowTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Row view for decoders plugins. 12 | * 13 | * @class DecodersRow 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var DecodersRow = BaseView.extend({ 19 | tagName: "tr", 20 | presenter: PluginPresenter, 21 | template: DecodersRowTemplate, 22 | 23 | initialize: function() { 24 | this.listenTo(this.model, "change", this.render, this); 25 | } 26 | }); 27 | 28 | return DecodersRow; 29 | } 30 | ); 31 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/encoders_row.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "presenters/plugin_presenter", 5 | "hgn!templates/health/encoders_row" 6 | ], 7 | function(BaseView, PluginPresenter, EncodersRowTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Row view for encoders plugins. 12 | * 13 | * @class EncodersRow 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var EncodersRow = BaseView.extend({ 19 | tagName: "tr", 20 | presenter: PluginPresenter, 21 | template: EncodersRowTemplate, 22 | 23 | initialize: function() { 24 | this.listenTo(this.model, "change", this.render, this); 25 | } 26 | }); 27 | 28 | return EncodersRow; 29 | } 30 | ); 31 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/router_widget.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "presenters/plugin_presenter", 5 | "hgn!templates/health/router_widget" 6 | ], 7 | function(BaseView, PluginPresenter, RouterWidgetTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Widget for router processed count. 12 | * 13 | * @class RouterWidget 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var RouterWidget = BaseView.extend({ 19 | presenter: PluginPresenter, 20 | template: RouterWidgetTemplate, 21 | 22 | initialize: function() { 23 | this.listenTo(this.model, "change:ProcessMessageCount.value", this.render, this); 24 | } 25 | }); 26 | 27 | return RouterWidget; 28 | } 29 | ); 30 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # heka_build image 2 | # Uses heka base which includes a built checkout of heka, and then builds a dpkg 3 | # and builds a new image which installs that dpkg 4 | FROM mozilla/heka_base 5 | 6 | RUN cd /heka && . ./build.sh 7 | RUN cd /heka && . ./env.sh && cd /heka/build && make deb 8 | 9 | RUN mkdir -p /heka_docker 10 | RUN find /heka/build -name "*.deb" -exec cp {} /heka_docker/heka.deb \; 11 | COPY Dockerfile.final /heka_docker/Dockerfile 12 | 13 | RUN curl -sSL https://get.docker.io/builds/Linux/x86_64/docker-1.2.0 -o /tmp/docker && \ 14 | echo "540459bc5d9f1cac17fe8654891814314db15e77 /tmp/docker" | sha1sum -c - && \ 15 | mv /tmp/docker /usr/local/bin/docker && \ 16 | chmod +x /usr/local/bin/docker 17 | 18 | CMD docker build -t mozilla/heka /heka_docker -------------------------------------------------------------------------------- /sandbox/lua/testsupport/lpeg_csv.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | require "cjson" 6 | require "lpeg" 7 | 8 | -- csv grammar 9 | local field = '"' * lpeg.Cs(((lpeg.P(1) - '"') + lpeg.P'""' / '"')^0) * '"' + 10 | lpeg.C((1 - lpeg.S',\n"')^0) 11 | local record = lpeg.Ct(field * (',' * field)^0) * (lpeg.P'\n' + -1) 12 | 13 | function process_message () 14 | local payload = read_message("Payload") 15 | 16 | inject_payload("json", "split csv", 17 | cjson.encode(lpeg.match(record, payload))) 18 | return 0 19 | end 20 | 21 | function timer_event(ns) 22 | end 23 | -------------------------------------------------------------------------------- /docs/source/config/inputs/file_polling.rst: -------------------------------------------------------------------------------- 1 | .. _config_file_polling_input: 2 | 3 | File Polling Input 4 | ================== 5 | 6 | .. versionadded:: 0.7 7 | 8 | Plugin Name: **FilePollingInput** 9 | 10 | FilePollingInputs periodically read (unbuffered) the contents of a file 11 | specified, and creates a Heka message with the contents of the file as the 12 | payload. 13 | 14 | Config: 15 | 16 | - file_path(string): 17 | The absolute path to the file which the input should read. 18 | 19 | - ticker_interval (unit): 20 | How often, in seconds to input should read the contents of the file. 21 | 22 | Example: 23 | 24 | .. code-block:: ini 25 | 26 | [MemStats] 27 | type = "FilePollingInput" 28 | ticker_interval = 1 29 | file_path = "/proc/meminfo" 30 | decoder = "MemStatsDecoder" 31 | 32 | -------------------------------------------------------------------------------- /dasher/javascript/models/sandbox_output.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "backbone", 4 | "deepModel" 5 | ], 6 | function(Backbone) { 7 | "use strict"; 8 | 9 | /** 10 | * Specific output from a Sandbox. 11 | * 12 | * @class SandboxOutput 13 | * 14 | * @constructor 15 | */ 16 | var SandboxOutput = Backbone.DeepModel.extend({}); 17 | 18 | /** 19 | * Name of the sandbox output. 20 | * 21 | * @property {String} Name 22 | */ 23 | 24 | /** 25 | * Filename of the sandbox output. These are relative paths that start with `data/*`. 26 | * 27 | * @property {String} Filename 28 | */ 29 | 30 | /** 31 | * Data parsed from reading file found at Filename. 32 | * 33 | * @property {String,Object} data 34 | */ 35 | 36 | return SandboxOutput; 37 | } 38 | ); 39 | -------------------------------------------------------------------------------- /docs/source/config/encoders/protobuf.rst: -------------------------------------------------------------------------------- 1 | .. _config_protobufencoder: 2 | 3 | Protobuf Encoder 4 | ================ 5 | 6 | Plugin Name: **ProtobufEncoder** 7 | 8 | The ProtobufEncoder is used to serialize Heka message objects back into Heka's 9 | standard protocol buffers format. This is the format that Heka uses to 10 | communicate with other Heka instances, so one will always be included in your 11 | Heka configuration using the default "ProtobufEncoder" name whether specified 12 | or not. 13 | 14 | The hekad protocol buffers message schema is defined in the `message.proto` 15 | file in the `message` package. 16 | 17 | Config: 18 | 19 | 20 | 21 | Example: 22 | 23 | .. code-block:: ini 24 | 25 | [ProtobufEncoder] 26 | 27 | .. seealso:: `Protocol Buffers - Google's data interchange format 28 | `_ 29 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/decoders_row.mustache: -------------------------------------------------------------------------------- 1 | {{Name}} 2 | 3 |
4 |
5 | {{InChanPercent}}% Complete 6 |
7 |
8 | 9 | {{ProcessMessageFailuresFormatted}} 10 | {{ProcessMessageAvgDurationFormatted}} {{ProcessMessageAvgDuration.representation}} 11 | {{ProcessMessageCountFormatted}} 12 | -------------------------------------------------------------------------------- /docs/source/config/decoders/protobuf.rst: -------------------------------------------------------------------------------- 1 | .. _config_protobuf_decoder: 2 | 3 | Protobuf Decoder 4 | ================ 5 | 6 | Plugin Name: **ProtobufDecoder** 7 | 8 | The ProtobufDecoder is used for Heka message objects that have been serialized 9 | into protocol buffers format. This is the format that Heka uses to communicate 10 | with other Heka instances, so one will always be included in your Heka 11 | configuration under the name "ProtobufDecoder", whether specified or not. The 12 | ProtobufDecoder has no configuration options. 13 | 14 | The hekad protocol buffers message schema is defined in the `message.proto` 15 | file in the `message` package. 16 | 17 | Example: 18 | 19 | .. code-block:: ini 20 | 21 | [ProtobufDecoder] 22 | 23 | .. seealso:: `Protocol Buffers - Google's data interchange format 24 | `_ 25 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/encoder_json.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | require "cjson" 6 | 7 | local msg = { 8 | Timestamp = nil, 9 | Hostname = nil, 10 | Payload = nil, 11 | Type = nil, 12 | Pid = nil, 13 | Severity = nil, 14 | Fields = nil 15 | } 16 | 17 | function process_message() 18 | msg.Timestamp = read_message("Timestamp") 19 | msg.Hostname = read_message("Hostname") 20 | msg.Pid = read_message("Pid") 21 | msg.Severity = read_message("Severity") 22 | msg.Payload = read_message("Payload") 23 | msg.Type = read_message("Type") 24 | inject_payload("json", "message_table", cjson.encode(msg)) 25 | return 0 26 | end 27 | -------------------------------------------------------------------------------- /packaging/debian/heka.preinst.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | USER="heka" 6 | GROUP="$USER" 7 | 8 | # If we use NIS then errors should be tolerated. 9 | if which ypwhich >/dev/null 2>&1 && ypwhich >/dev/null 2>&1 10 | then 11 | set +e 12 | fi 13 | 14 | if ! getent group $GROUP >/dev/null 15 | then 16 | addgroup --system $GROUP >/dev/null 17 | fi 18 | 19 | # creating user if it isn't already there 20 | if ! getent passwd $USER >/dev/null 21 | then 22 | adduser \ 23 | --system \ 24 | --disabled-login \ 25 | --ingroup $GROUP \ 26 | --no-create-home \ 27 | --home /var/cache/hekad \ 28 | --gecos "heka daemon" \ 29 | --shell /bin/false \ 30 | $USER >/dev/null 31 | fi 32 | 33 | # end of NIS tolerance zone 34 | set -e 35 | 36 | install -d -m0755 -o$USER -g$GROUP /var/cache/hekad 37 | 38 | #DEBHELPER# 39 | -------------------------------------------------------------------------------- /plugins/smtp/all_spec_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package smtp 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(EncoderSpec) 27 | r.AddSpec(SmtpOutputSpec) 28 | 29 | gospec.MainGoTest(r, t) 30 | } 31 | -------------------------------------------------------------------------------- /docs/source/config/filters/counter.rst: -------------------------------------------------------------------------------- 1 | .. _config_counter_filter: 2 | 3 | Counter Filter 4 | ============== 5 | 6 | Plugin Name: **CounterFilter** 7 | 8 | Once per ticker interval a CounterFilter will generate a message of type `heka 9 | .counter-output`. The payload will contain text indicating the number of 10 | messages that matched the filter's `message_matcher` value during that 11 | interval (i.e. it counts the messages the plugin received). Every ten 12 | intervals an extra message (also of type `heka.counter-output`) goes out, 13 | containing an aggregate count and average per second throughput of messages 14 | received. 15 | 16 | Config: 17 | 18 | - ticker_interval (int, optional): 19 | Interval between generated counter messages, in seconds. Defaults to 5. 20 | 21 | Example: 22 | 23 | .. code-block:: ini 24 | 25 | [CounterFilter] 26 | message_matcher = "Type != 'heka.counter-output'" 27 | -------------------------------------------------------------------------------- /plugins/file/all_spec_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package file 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(FileOutputSpec) 27 | r.AddSpec(FilePollingInputSpec) 28 | 29 | gospec.MainGoTest(r, t) 30 | } 31 | -------------------------------------------------------------------------------- /logstreamer/logstream_specs_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # Mike Trinkala (trink@mozilla.com) 13 | # 14 | # ***** END LICENSE BLOCK *****/ 15 | package logstreamer 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.AddSpec(FilehandlingSpec) 25 | r.AddSpec(ReaderSpec) 26 | gospec.MainGoTest(r, t) 27 | } 28 | -------------------------------------------------------------------------------- /pipeline/pipeline_signals_windows.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Victor Ng (vng@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package pipeline 16 | 17 | import ( 18 | "syscall" 19 | ) 20 | 21 | // Define it since it is not defined for Windows. 22 | 23 | // Note that you will need to manually send signal 10 to hekad as 24 | // SIGUSR1 isn't defined on Windows. 25 | 26 | const SIGUSR1 = syscall.Signal(0xa) 27 | const SIGUSR2 = syscall.Signal(0xb) 28 | -------------------------------------------------------------------------------- /plugins/payload/all_spec_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package payload 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(MultiDecoderSpec) 27 | r.AddSpec(PayloadDecodersSpec) 28 | 29 | gospec.MainGoTest(r, t) 30 | } 31 | -------------------------------------------------------------------------------- /plugins/statsd/all_spec_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package statsd 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(StatsdInputSpec) 27 | r.AddSpec(StatsToFieldsDecoderSpec) 28 | 29 | gospec.MainGoTest(r, t) 30 | } 31 | -------------------------------------------------------------------------------- /docs/source/config/outputs/sandbox.rst: -------------------------------------------------------------------------------- 1 | .. _config_sandbox_output: 2 | 3 | Sandbox Output 4 | ============== 5 | 6 | .. versionadded:: 0.9 7 | 8 | Plugin Name: **SandboxOutput** 9 | 10 | The SandboxOutput provides a flexible execution environment for data encoding 11 | and transmission without the need to recompile Heka. See :ref:`sandbox`. 12 | 13 | .. _sandboxoutput_settings: 14 | 15 | Config: 16 | 17 | - The common output configuration parameter 'encoder' is ignored since all data 18 | transformation should happen in the plugin. 19 | - :ref:`config_common_sandbox_parameters` 20 | - timer_event_on_shutdown (bool): 21 | True if the sandbox should have its timer_event function called on shutdown. 22 | 23 | Example 24 | 25 | .. code-block:: ini 26 | 27 | [SandboxFileOutput] 28 | type = "SandboxOutput" 29 | filename = "fileoutput.lua" 30 | 31 | [SandboxFileOutput.config] 32 | path = "mylog.txt" 33 | 34 | -------------------------------------------------------------------------------- /plugins/udp/all_specs_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2014 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package udp 16 | 17 | import ( 18 | gs "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gs.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(UdpInputSpec) 27 | r.AddSpec(UdpInputSpecFailure) 28 | r.AddSpec(UdpOutputSpec) 29 | 30 | gs.MainGoTest(r, t) 31 | } 32 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/nagios.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | local state = 0 6 | 7 | function process_message () 8 | return 0 9 | end 10 | 11 | 12 | function timer_event(ns) 13 | 14 | if state == 0 then 15 | add_to_payload("OK:Ok alerts are working!") 16 | elseif state == 1 then 17 | add_to_payload("WARNING:Warning alerts are working!") 18 | elseif state == 2 then 19 | add_to_payload("CRITICAL:Critical alerts are working!") 20 | elseif state == 3 then 21 | add_to_payload("UNKNOWN:Unknown alerts are working!") 22 | end 23 | state = state + 1 24 | if state == 4 then state = 0 end 25 | 26 | inject_payload("nagios-external-command", "PROCESS_SERVICE_CHECK_RESULT") 27 | end 28 | 29 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/hekabench_cbuf_counter.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | require "circular_buffer" 6 | 7 | last_inject = 0 8 | count = 0 9 | cnts = circular_buffer.new(3600, 1, 1) -- 1 hour window with 1 second resolution 10 | local MESSAGES = cnts:set_header(1, "Messages", "count") 11 | 12 | function process_message () 13 | -- normally we would use the message time stamp but flood messages have a fixed time 14 | count = count + 1 15 | return 0 16 | end 17 | 18 | 19 | function timer_event(ns) 20 | cnts:add(ns, MESSAGES, count) 21 | count = 0 22 | if ns - last_inject > 60e9 then -- write the aggregate once a minute 23 | inject_payload("cbuf", "", cnts) 24 | last_inject = ns 25 | end 26 | end 27 | 28 | -------------------------------------------------------------------------------- /plugins/http/all_spec_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package http 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(HttpInputSpec) 27 | r.AddSpec(HttpListenInputSpec) 28 | r.AddSpec(HttpOutputSpec) 29 | 30 | gospec.MainGoTest(r, t) 31 | } 32 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/read_config.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | local s = read_config("string") 6 | if s ~= "widget" then error("string") end 7 | 8 | local n = read_config("int64") 9 | if n ~= 99 then return error("int") end 10 | 11 | local d = read_config("double") 12 | if d ~= 99.123 then error("double") end 13 | 14 | local b = read_config("bool") 15 | if b ~= true then error("bool") end 16 | 17 | local n = read_config("nil") 18 | if n ~= nil then error("nil") end 19 | 20 | local a = read_config("array") 21 | if a ~= nil then error("array") end 22 | 23 | local o = read_config("object") 24 | if o ~= nil then return error("object") end 25 | 26 | function process_message () 27 | return 0 28 | end 29 | 30 | function timer_event() 31 | end 32 | 33 | -------------------------------------------------------------------------------- /plugins/graphite/all_spec_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package graphite 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(CarbonOutputSpec) 27 | r.AddSpec(WhisperOutputSpec) 28 | r.AddSpec(WhisperRunnerSpec) 29 | 30 | gospec.MainGoTest(r, t) 31 | } 32 | -------------------------------------------------------------------------------- /plugins/process/all_specs_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package process 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(ProcessChainSpec) 27 | r.AddSpec(ProcessInputSpec) 28 | r.AddSpec(ProcessDirectoryInputSpec) 29 | 30 | gospec.MainGoTest(r, t) 31 | } 32 | -------------------------------------------------------------------------------- /plugins/tcp/all_specs_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package tcp 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(TcpInputSpec) 27 | r.AddSpec(TcpOutputSpec) 28 | r.AddSpec(TlsSpec) 29 | r.AddSpec(TcpInputSpecFailure) 30 | 31 | gospec.MainGoTest(r, t) 32 | } 33 | -------------------------------------------------------------------------------- /dasher/javascript/templates/sandboxes/sandboxes_index.mustache: -------------------------------------------------------------------------------- 1 |

Sandboxes

2 | 3 | {{#collection.length}} 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{#collection}} 11 | 12 | 13 | 14 | {{#Outputs}} 15 | 16 | 17 | 18 | 19 | {{/Outputs}} 20 | {{/collection}} 21 | 22 |
NameType
{{Name}}
{{Name}}{{^Name}}[Untitled]{{/Name}}{{Type}}
23 | {{/collection.length}} 24 | 25 | {{^collection.length}} 26 |
No sandboxes are configured
27 | {{/collection.length}} 28 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/inputs_index.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "views/health/inputs_row", 5 | "hgn!templates/health/inputs_index" 6 | ], 7 | function(BaseView, InputsRow, InputsIndexTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Index view for input plugins. 12 | * 13 | * @class InputsIndex 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var InputsIndex = BaseView.extend({ 19 | template: InputsIndexTemplate, 20 | 21 | initialize: function() { 22 | this.listenTo(this.collection, "add remove reset", this.render, this); 23 | }, 24 | 25 | /** 26 | * Renders InputsRow into `.inputs tbody` after render. 27 | * 28 | * @method afterRender 29 | */ 30 | afterRender: function() { 31 | this.renderCollection(InputsRow, ".inputs tbody"); 32 | } 33 | }); 34 | 35 | return InputsIndex; 36 | } 37 | ); 38 | -------------------------------------------------------------------------------- /plugins/all_specs_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package plugins 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "testing" 20 | ) 21 | 22 | func TestAllSpecs(t *testing.T) { 23 | r := gospec.NewRunner() 24 | r.Parallel = false 25 | 26 | r.AddSpec(LoadFromConfigSpec) 27 | r.AddSpec(ScribbleDecoderSpec) 28 | r.AddSpec(PayloadEncoderSpec) 29 | r.AddSpec(RstEncoderSpec) 30 | 31 | gospec.MainGoTest(r, t) 32 | } 33 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/filters_index.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "views/health/filters_row", 5 | "hgn!templates/health/filters_index" 6 | ], 7 | function(BaseView, FiltersRow, FiltersIndexTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Index view for filter plugins. 12 | * 13 | * @class FiltersIndex 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var FiltersIndex = BaseView.extend({ 19 | template: FiltersIndexTemplate, 20 | 21 | initialize: function() { 22 | this.listenTo(this.collection, "add remove reset", this.render, this); 23 | }, 24 | 25 | /** 26 | * Renders FiltersRow into `.filters tbody` after render. 27 | * 28 | * @method afterRender 29 | */ 30 | afterRender: function() { 31 | this.renderCollection(FiltersRow, ".filters tbody"); 32 | } 33 | }); 34 | 35 | return FiltersIndex; 36 | } 37 | ); 38 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/outputs_index.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "views/health/outputs_row", 5 | "hgn!templates/health/outputs_index" 6 | ], 7 | function(BaseView, OutputsRow, OutputsIndexTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Index view for output plugins. 12 | * 13 | * @class OutputsIndex 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var OutputsIndex = BaseView.extend({ 19 | template: OutputsIndexTemplate, 20 | 21 | initialize: function() { 22 | this.listenTo(this.collection, "add remove reset", this.render, this); 23 | }, 24 | 25 | /** 26 | * Renders OutputsRow into `.outputs tbody` after render. 27 | * 28 | * @method afterRender 29 | */ 30 | afterRender: function() { 31 | this.renderCollection(OutputsRow, ".outputs tbody"); 32 | } 33 | }); 34 | 35 | return OutputsIndex; 36 | } 37 | ); 38 | -------------------------------------------------------------------------------- /docs/source/config/splitters/null.rst: -------------------------------------------------------------------------------- 1 | .. _config_null_splitter: 2 | 3 | Null Splitter 4 | ============= 5 | 6 | Plugin Name: **NullSplitter** 7 | 8 | The NullSplitter is used in cases where the incoming data is already naturally 9 | divided into logical messages, such that Heka doesn't need to do any further 10 | splitting. For instance, when used in conjunction with a UdpInput, the 11 | contents of each UDP packet will be made into a separate message. 12 | 13 | Note that this means generally the NullSplitter should not be used with a 14 | stream oriented input transport, such as with TcpInput or LogstreamerInput. If 15 | this is done then the splitting will be arbitrary, each message will contain 16 | whatever happens to be the contents of a particular read operation. 17 | 18 | The NullSplitter has no configuration options, and is automatically registered 19 | as an available splitter plugin of the name "NullSplitter", so it doesn't 20 | require a separate TOML configuration section. 21 | -------------------------------------------------------------------------------- /docs/source/config/filters/sandbox.rst: -------------------------------------------------------------------------------- 1 | .. _config_sandbox_filter: 2 | 3 | Sandbox Filter 4 | ============== 5 | 6 | Plugin Name: **SandboxFilter** 7 | 8 | The sandbox filter provides an isolated execution environment for data 9 | analysis. Any output generated by the sandbox is injected into the payload of 10 | a new message for further processing or to be output. 11 | 12 | Config: 13 | 14 | - :ref:`config_common_filter_parameters` 15 | 16 | - :ref:`config_common_sandbox_parameters` 17 | 18 | - timer_event_on_shutdown (bool): 19 | True if the sandbox should have its timer_event function called on shutdown. 20 | 21 | Example: 22 | 23 | .. code-block:: ini 24 | 25 | [hekabench_counter] 26 | type = "SandboxFilter" 27 | message_matcher = "Type == 'hekabench'" 28 | ticker_interval = 1 29 | filename = "counter.lua" 30 | preserve_data = true 31 | profile = false 32 | 33 | [hekabench_counter.config] 34 | rows = 1440 35 | sec_per_row = 60 36 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/decoders_index.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "views/health/decoders_row", 5 | "hgn!templates/health/decoders_index" 6 | ], 7 | function(BaseView, DecodersRow, DecodersIndexTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Index view for decoder plugins. 12 | * 13 | * @class DecodersIndex 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var DecodersIndex = BaseView.extend({ 19 | template: DecodersIndexTemplate, 20 | 21 | initialize: function() { 22 | this.listenTo(this.collection, "add remove reset", this.render, this); 23 | }, 24 | 25 | /** 26 | * Renders DecodersRow into `.decoders tbody` after render. 27 | * 28 | * @method afterRender 29 | */ 30 | afterRender: function() { 31 | this.renderCollection(DecodersRow, ".decoders tbody"); 32 | } 33 | }); 34 | 35 | return DecodersIndex; 36 | } 37 | ); 38 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/encoders_index.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "views/health/encoders_row", 5 | "hgn!templates/health/encoders_index" 6 | ], 7 | function(BaseView, EncodersRow, EncodersIndexTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Index view for Encoder plugins. 12 | * 13 | * @class EncodersIndex 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var EncodersIndex = BaseView.extend({ 19 | template: EncodersIndexTemplate, 20 | 21 | initialize: function() { 22 | this.listenTo(this.collection, "add remove reset", this.render, this); 23 | }, 24 | 25 | /** 26 | * Renders EncodersRow into `.encoders tbody` after render. 27 | * 28 | * @method afterRender 29 | */ 30 | afterRender: function() { 31 | this.renderCollection(EncodersRow, ".encoders tbody"); 32 | } 33 | }); 34 | 35 | return EncodersIndex; 36 | } 37 | ); 38 | -------------------------------------------------------------------------------- /dasher/javascript/presenters/termination_report_row_presenter.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "underscore", 4 | "moment" 5 | ], 6 | function(_, moment) { 7 | "use strict"; 8 | 9 | /** 10 | * Presents a `TerminationReport` row for use in a view. 11 | * 12 | * @class TerminationReportRowPresenter 13 | * 14 | * @constructor 15 | * 16 | * @param {Plugin} plugin Plugin to be presented 17 | */ 18 | var TerminationReportRowPresenter = function (termination_report_row) { 19 | _.extend(this, termination_report_row.attributes); 20 | }; 21 | 22 | _.extend(TerminationReportRowPresenter.prototype, { 23 | /** 24 | * Format the date and time. 25 | * 26 | * @method formattedTime 27 | * @return {String} Formatted time e.g. Oct 28 2013 2:48 PM 28 | */ 29 | formattedTime: function() { 30 | return moment(this.time).format("lll"); 31 | } 32 | }); 33 | 34 | return TerminationReportRowPresenter; 35 | } 36 | ); 37 | -------------------------------------------------------------------------------- /cmake/FindHg.cmake: -------------------------------------------------------------------------------- 1 | # This Source Code Form is subject to the terms of the Mozilla Public 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | # The module defines the following variables: 6 | # HG_FOUND - true if the Hg was found 7 | # HG_EXECUTABLE - path to the executable 8 | # HG_VERSION - Hg version number 9 | # Example usage: 10 | # find_package(Hg 2.0 REQUIRED) 11 | 12 | 13 | find_program(HG_EXECUTABLE hg PATHS ENV HG_ROOT HG_PATH PATH_SUFFIXES bin) 14 | if (HG_EXECUTABLE) 15 | execute_process(COMMAND ${HG_EXECUTABLE} version OUTPUT_VARIABLE HG_VERSION_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE) 16 | if(HG_VERSION_OUTPUT MATCHES "\(version ([^)]+)\)") 17 | set(HG_VERSION ${CMAKE_MATCH_1}) 18 | endif() 19 | endif() 20 | mark_as_advanced(HG_EXECUTABLE) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | find_package_handle_standard_args(Hg REQUIRED_VARS HG_EXECUTABLE HG_VERSION VERSION_VAR HG_VERSION) 24 | -------------------------------------------------------------------------------- /dasher/javascript/views/sandboxes/sandboxes_index.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "hgn!templates/sandboxes/sandboxes_index", 5 | "adapters/sandboxes_adapter", 6 | "presenters/plugin_presenter" 7 | ], 8 | function(BaseView, SandboxesIndexTemplate, SandboxesAdapter, PluginPresenter) { 9 | "use strict"; 10 | 11 | /** 12 | * Index view for sandboxes. This is a top level view that's loaded by the router. 13 | * 14 | * @class SandboxesIndex 15 | * @extends BaseView 16 | * 17 | * @constructor 18 | */ 19 | var SandboxesIndex = BaseView.extend({ 20 | presenter: PluginPresenter, 21 | template: SandboxesIndexTemplate, 22 | 23 | initialize: function() { 24 | this.adapter = SandboxesAdapter.instance(); 25 | this.collection = this.adapter.sandboxes; 26 | 27 | this.listenTo(this.collection, "add remove reset change", this.render, this); 28 | 29 | this.adapter.fill(); 30 | } 31 | }); 32 | 33 | return SandboxesIndex; 34 | } 35 | ); 36 | -------------------------------------------------------------------------------- /plugins/testsupport/config_test_multidecoder.toml: -------------------------------------------------------------------------------- 1 | [syncdecoder] 2 | type = "MultiDecoder" 3 | subs = ['syncformat', 'syncraw'] 4 | 5 | [syncformat] 6 | type = "PayloadRegexDecoder" 7 | match_regex = '^(?P\S+) \S+ (?P\S+) \[(?P[^\]]+)\] "(?P[A-Z]+) (?P[^\s]+)[^"]*" (?P\d+) (?P\d+) "(?P[^"]*)" "(?P[^"]*)" ".*" ".*" node_s:\d+\.\d+ req_s:(?P\d+\.\d+) retries:\d+ req_b:(?P\d+)' 8 | timestamp_layout = "02/Jan/2006:15:04:05 -0700" 9 | 10 | [syncformat.message_fields] 11 | RemoteIP|ipv4 = "%RemoteIP%" 12 | User = "%User%" 13 | Method = "%Method%" 14 | Url|uri = "%Url%" 15 | StatusCode = "%StatusCode%" 16 | RequestSize|B= "%RequestSize%" 17 | Referer = "%Referer%" 18 | Browser = "%Browser%" 19 | ResponseTime|s = "%ResponseTime%" 20 | ResponseSize|B = "%ResponseSize%" 21 | Payload = "" 22 | 23 | [syncraw] 24 | type = "PayloadRegexDecoder" 25 | match_regex = '^(?P.*)' 26 | 27 | [syncraw.message_fields] 28 | Somedata = "%TheData%" 29 | -------------------------------------------------------------------------------- /docs/source/config/encoders/index_noref.rst: -------------------------------------------------------------------------------- 1 | 2 | ======== 3 | Encoders 4 | ======== 5 | 6 | .. include:: /config/encoders/alert.rst 7 | :start-line: 1 8 | 9 | .. include:: /config/encoders/cbuf_librato.rst 10 | :start-line: 1 11 | 12 | .. include:: /config/encoders/esjson.rst 13 | :start-line: 1 14 | 15 | .. include:: /config/encoders/eslogstashv0.rst 16 | :start-line: 1 17 | 18 | .. include:: /config/encoders/espayload.rst 19 | :start-line: 1 20 | 21 | .. include:: /config/encoders/payload.rst 22 | :start-line: 1 23 | 24 | .. include:: /config/encoders/protobuf.rst 25 | :start-line: 1 26 | 27 | .. include:: /config/encoders/rst.rst 28 | :start-line: 1 29 | 30 | .. include:: /config/encoders/sandbox.rst 31 | :start-line: 1 32 | 33 | .. include:: /config/encoders/schema_carbon_line.rst 34 | :start-line: 1 35 | 36 | .. include:: /config/encoders/schema_influx.rst 37 | :start-line: 1 38 | 39 | .. include:: /config/encoders/schema_influx_line.rst 40 | :start-line: 1 41 | 42 | .. include:: /config/encoders/statmetric_influx.rst 43 | :start-line: 1 44 | -------------------------------------------------------------------------------- /plugins/testsupport/support.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package testsupport 16 | 17 | import ( 18 | "github.com/rafrombrc/gospec/src/gospec" 19 | "strings" 20 | ) 21 | 22 | func StringContains(actual interface{}, criteria interface{}) (match bool, 23 | pos gospec.Message, neg gospec.Message, err error) { 24 | toTest := actual.(string) 25 | critTest := criteria.(string) 26 | match = strings.Contains(toTest, critTest) 27 | pos = gospec.Messagef(toTest, "contains "+critTest) 28 | neg = gospec.Messagef(toTest, "does not contain "+critTest) 29 | return 30 | } 31 | -------------------------------------------------------------------------------- /cmake/FindProtobuf.cmake: -------------------------------------------------------------------------------- 1 | # This Source Code Form is subject to the terms of the Mozilla Public 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | # The module defines the following variables: 6 | # PROTOBUF_FOUND - true if the Protobuf was found 7 | # PROTOBUF_EXECUTABLE - path to the executable 8 | # PROTOBUF_VERSION - Protobuf version number 9 | # Example usage: 10 | # find_package(Protobuf 2.3 REQUIRED) 11 | 12 | 13 | find_program(PROTOBUF_EXECUTABLE protoc PATH_SUFFIXES bin) 14 | if (PROTOBUF_EXECUTABLE) 15 | execute_process(COMMAND ${PROTOBUF_EXECUTABLE} --version OUTPUT_VARIABLE PROTOBUF_VERSION_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE) 16 | if(PROTOBUF_VERSION_OUTPUT MATCHES "libprotoc ([0-9]+\\.[0-9]+\\.[0-9]+)") 17 | set(PROTOBUF_VERSION ${CMAKE_MATCH_1}) 18 | endif() 19 | endif() 20 | mark_as_advanced(PROTOBUF_EXECUTABLE) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | find_package_handle_standard_args(Protobuf REQUIRED_VARS PROTOBUF_EXECUTABLE PROTOBUF_VERSION VERSION_VAR PROTOBUF_VERSION) 24 | -------------------------------------------------------------------------------- /plugins/tcp/testsupport/cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC6DCCAdKgAwIBAgIBADALBgkqhkiG9w0BAQUwEjEQMA4GA1UEChMHQWNtZSBD 3 | bzAeFw0xNDAxMTAxOTEyNTFaFw0xNTAxMTAxOTEyNTFaMBIxEDAOBgNVBAoTB0Fj 4 | bWUgQ28wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZUi4r0eSpxJKr 5 | Bwewx0/eNZdtQ1u1c+2cJQabB9WF8WPBoCGVIUUyfgsIDU/B/nbZUewbeMusj/jK 6 | ywwNwyzHfy/ap+4FCiu1hJRNmV/CjgbLSgkoGeJfsB6JRvXBAqLMmHY4UEktnbnD 7 | G0A4Ho2P+D9mTnYxnGYnZdExmLL5lqGfnYpixsffZ+0CuHb0yT/gWtJyb3qRnXIX 8 | AnkqzTr+evSS6zEhuknS45AxwhDOR1eEzGWnCtdN2oj1NkQkNfBItdBxLhbwOU9n 9 | vYQe6QlfHHA4s4S/A03olET4Q1hQ8PotLK/y0apPXZZmIZ+fUS5UYDKRsFQ6ug8X 10 | fHdymxjjAgMBAAGjTTBLMA4GA1UdDwEB/wQEAwIAoDATBgNVHSUEDDAKBggrBgEF 11 | BQcDATAMBgNVHRMBAf8EAjAAMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMAsGCSqG 12 | SIb3DQEBBQOCAQEACrbqO89rmqox31cRHMxGaxL5/UJY2MH3RSqPLdL1/tE7AwJo 13 | Vxi0rqi4DYb/2ln5vSJe4hrHhBSucoA1ARyBHFqXOZ/4B6U4c6H8Ue9ydiT7KiT3 14 | RfYnzd100OGMDeF1sPCZZaPXElcsyPuqTeBaEUUYjnJdlKfthB9NO5dkXx/TqyQ0 15 | fXDKg2y4l1H+DUWfKvhf/uVsBF6Z0s8XPfmy7IB6Y+SCMIYrgWjNjjS7rtLhC/Ws 16 | rmJufl5/3AWMF3u7viBY/pcD5LdnRzJAUn8d7rTwzCeJV93gvgRmx5zpluWZvNBS 17 | qTm4KIY6lt9pjMUAiw9YUB9Pq5J+eEesceAzEA== 18 | -----END CERTIFICATE----- 19 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/plugins_row.mustache: -------------------------------------------------------------------------------- 1 | {{Name}} 2 | 3 |
4 |
5 | {{InChanPercent}}% Complete 6 |
7 |
8 | 9 | 10 | {{#hasMatchChannel}} 11 |
12 |
13 | {{MatchChanPercent}}% Complete 14 |
15 |
16 | {{/hasMatchChannel}} 17 | 18 | {{MatchAvgDurationFormatted}} {{MatchAvgDuration.representation}} 19 | {{ProcessMessageCountFormatted}} 20 | 21 | -------------------------------------------------------------------------------- /docs/source/config/outputs/carbon.rst: -------------------------------------------------------------------------------- 1 | .. _config_carbon_output: 2 | 3 | Carbon Output 4 | ============= 5 | 6 | Plugin Name: **CarbonOutput** 7 | 8 | CarbonOutput plugins parse the "stat metric" messages generated by a 9 | StatAccumulator and write the extracted counter, timer, and gauge data out to 10 | a `graphite `_ compatible `carbon 11 | `_ daemon. Output is written over 12 | a TCP or UDP socket using the `plaintext `_ protocol. 13 | 14 | Config: 15 | 16 | - address (string): 17 | An IP address:port on which this plugin will write to. 18 | (default: "localhost:2003") 19 | 20 | .. versionadded:: 0.5 21 | 22 | - protocol (string): 23 | "tcp" or "udp" 24 | (default: "tcp") 25 | - tcp_keep_alive (bool) 26 | if set, keep the TCP connection open and reuse it until a failure; then retry 27 | (default: false) 28 | 29 | Example: 30 | 31 | .. code-block:: ini 32 | 33 | [CarbonOutput] 34 | message_matcher = "Type == 'heka.statmetric'" 35 | address = "localhost:2003" 36 | protocol = "udp" 37 | -------------------------------------------------------------------------------- /docs/source/config/inputs/statsd.rst: -------------------------------------------------------------------------------- 1 | .. _config_statsd_input: 2 | 3 | Statsd Input 4 | ============ 5 | 6 | Plugin Name: **StatsdInput** 7 | 8 | Listens for `statsd protocol `_ `counter`, 9 | `timer`, or `gauge` messages on a UDP port, and generates `Stat` objects that 10 | are handed to a `StatAccumulator` for aggregation and processing. 11 | 12 | Config: 13 | 14 | - address (string): 15 | An IP address:port on which this plugin will expose a statsd server. 16 | Defaults to "127.0.0.1:8125". 17 | - stat_accum_name (string): 18 | Name of a StatAccumInput instance that this StatsdInput will use as its 19 | StatAccumulator for submitting received stat values. Defaults to 20 | "StatAccumInput". 21 | - max_msg_size (uint): 22 | Size of a buffer used for message read from statsd. In some cases, when statsd 23 | sends a lots in single message of stats it's required to boost this value. 24 | All over-length data will be truncated without raising an error. Defaults to 512. 25 | 26 | Example: 27 | 28 | .. code-block:: ini 29 | 30 | [StatsdInput] 31 | address = ":8125" 32 | stat_accum_name = "custom_stat_accumulator" 33 | -------------------------------------------------------------------------------- /plugins/testsupport/config_test_multidecoder_nested.toml: -------------------------------------------------------------------------------- 1 | [syncdecoder] 2 | type = "MultiDecoder" 3 | subs = ['syncformat', 'nesteddecoder'] 4 | 5 | [nesteddecoder] 6 | type = "MultiDecoder" 7 | subs = ['syncformat', 'syncraw'] 8 | 9 | [syncformat] 10 | type = "PayloadRegexDecoder" 11 | match_regex = '^(?P\S+) \S+ (?P\S+) \[(?P[^\]]+)\] "(?P[A-Z]+) (?P[^\s]+)[^"]*" (?P\d+) (?P\d+) "(?P[^"]*)" "(?P[^"]*)" ".*" ".*" node_s:\d+\.\d+ req_s:(?P\d+\.\d+) retries:\d+ req_b:(?P\d+)' 12 | timestamp_layout = "02/Jan/2006:15:04:05 -0700" 13 | 14 | [syncformat.message_fields] 15 | RemoteIP|ipv4 = "%RemoteIP%" 16 | User = "%User%" 17 | Method = "%Method%" 18 | Url|uri = "%Url%" 19 | StatusCode = "%StatusCode%" 20 | RequestSize|B= "%RequestSize%" 21 | Referer = "%Referer%" 22 | Browser = "%Browser%" 23 | ResponseTime|s = "%ResponseTime%" 24 | ResponseSize|B = "%ResponseSize%" 25 | Payload = "" 26 | 27 | [syncraw] 28 | type = "PayloadRegexDecoder" 29 | match_regex = '^(?P.*)' 30 | 31 | [syncraw.message_fields] 32 | Somedata = "%TheData%" 33 | -------------------------------------------------------------------------------- /plugins/testsupport/config_test_multidecoder_nested_cyclic.toml: -------------------------------------------------------------------------------- 1 | [syncdecoder] 2 | type = "MultiDecoder" 3 | subs = ['syncformat', 'nesteddecoder'] 4 | 5 | [nesteddecoder] 6 | type = "MultiDecoder" 7 | subs = ['syncdecoder', 'syncraw'] 8 | 9 | [syncformat] 10 | type = "PayloadRegexDecoder" 11 | match_regex = '^(?P\S+) \S+ (?P\S+) \[(?P[^\]]+)\] "(?P[A-Z]+) (?P[^\s]+)[^"]*" (?P\d+) (?P\d+) "(?P[^"]*)" "(?P[^"]*)" ".*" ".*" node_s:\d+\.\d+ req_s:(?P\d+\.\d+) retries:\d+ req_b:(?P\d+)' 12 | timestamp_layout = "02/Jan/2006:15:04:05 -0700" 13 | 14 | [syncformat.message_fields] 15 | RemoteIP|ipv4 = "%RemoteIP%" 16 | User = "%User%" 17 | Method = "%Method%" 18 | Url|uri = "%Url%" 19 | StatusCode = "%StatusCode%" 20 | RequestSize|B= "%RequestSize%" 21 | Referer = "%Referer%" 22 | Browser = "%Browser%" 23 | ResponseTime|s = "%ResponseTime%" 24 | ResponseSize|B = "%ResponseSize%" 25 | Payload = "" 26 | 27 | [syncraw] 28 | type = "PayloadRegexDecoder" 29 | match_regex = '^(?P.*)' 30 | 31 | [syncraw.message_fields] 32 | Somedata = "%TheData%" 33 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/07/error.log.2: -------------------------------------------------------------------------------- 1 | 123.65.150.10 - - [23/Aug/2010:03:50:59 +0000] "POST /wordpress3/wp-admin/admin-ajax.php HTTP/1.1" 200 2 "http://www.example.com/wordpress3/wp-admin/post-new.php" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.25 Safari/534.3" 2 | 80.154.42.54 - - [23/Aug/2010:15:25:35 +0000] "GET /phpmy-admin/scripts/setup.php HTTP/1.1" 404 347 "-" "ZmEu" 3 | 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 4 | 127.0.0.1 - - [05/Feb/2012:17:11:55 +0000] "GET / HTTP/1.1" 200 140 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.5 Safari/535.19" 5 | 80.154.42.54 - - [23/Aug/2010:15:25:35 +0000] "GET /phpmy-admin/scripts/setup.php HTTP/1.1" 404 347 "-" "ZmEu" 6 | 127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 7 | 127.0.0.1 - - [05/Feb/2012:17:11:55 +0000] "GET / HTTP/1.1" 200 140 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.5 Safari/535.19" 8 | 80.154.42.54 - - [23/Aug/2010:15:25:35 +0000] "GET /phpmy-admin/scripts/setup.php HTTP/1.1" 404 347 "-" "ZmEu" 9 | -------------------------------------------------------------------------------- /docs/source/config/splitters/regex.rst: -------------------------------------------------------------------------------- 1 | .. _config_regex_splitter: 2 | 3 | Regex Splitter 4 | ============== 5 | 6 | Plugin Name: **RegexSplitter** 7 | 8 | A RegexSplitter considers any text that matches a specified regular expression 9 | to represent a boundary on which records should be split. The regular 10 | expression may consist of exactly one capture group. If a capture group is 11 | specified, then the captured text will be included in the returned record. If 12 | not, then the returned record will not include the text that caused the 13 | regular expression match. 14 | 15 | Config: 16 | 17 | - delimiter (string) 18 | Regular expression to be used as the record boundary. May contain zero or 19 | one specified capture groups. 20 | - delimiter_eol (bool, optional): 21 | Specifies whether the contents of a delimiter capture group should be 22 | appended to the end of a record (true) or prepended to the beginning 23 | (false). Defaults to true. If the delimiter expression does not specify a 24 | capture group, this will have no effect. 25 | 26 | Example: 27 | 28 | .. code-block:: ini 29 | 30 | [mysql_slow_query_splitter] 31 | type = "RegexSplitter" 32 | delimiter = '\n(# User@Host:)' 33 | delimiter_eol = false 34 | -------------------------------------------------------------------------------- /pipeline/testsupport/sample-config.toml: -------------------------------------------------------------------------------- 1 | [hekad] 2 | cpuprof = "/var/log/hekad/cpuprof.log" 3 | max_message_loops = 4 4 | max_process_inject = 10 5 | max_timer_inject = 10 6 | maxprocs = 10 7 | memprof = "/var/log/hekad/memprof.log" 8 | plugin_chansize = 10 9 | poolsize = 100 10 | 11 | [StatsdInput] 12 | address = "127.0.0.1:8125" 13 | ticker_interval = 1 14 | stat_accum_name = "CustomStatAccum" 15 | 16 | [CustomStatAccum] 17 | type = "StatAccumInput" 18 | 19 | [TcpInput] 20 | address = "127.0.0.1:5565" 21 | parser_type = "message.proto" 22 | decoder = "ProtobufDecoder" 23 | 24 | [TcpInput2] 25 | type = "TcpInput" 26 | address = "127.0.0.1:5566" 27 | parser_type = "token" 28 | delimiter = "\n" 29 | 30 | [CounterFilter] 31 | message_matcher = "Type != 'heka.counter-output'" 32 | ticker_interval = 1 33 | 34 | [PayloadEncoder] 35 | 36 | [StatsdFileOutput] 37 | message_matcher = "Type == 'heka.statmetric'" 38 | type = "FileOutput" 39 | path = "log/statsdonly.log" 40 | encoder = "PayloadEncoder" 41 | 42 | [CounterFileOutput] 43 | type = "FileOutput" 44 | path = "log/counter.log" 45 | message_matcher = "Type == 'heka.counter-output'" 46 | 47 | [LogOutput] 48 | message_matcher = "Type == 'heka.counter-output'" 49 | payload_only = true 50 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2013/08/access.log: -------------------------------------------------------------------------------- 1 | 2014-01-14 09:16:25.276185 PST - Registered node with name '/Local' as hidden 2 | 2014-01-14 09:16:25.277358 PST - Registered node with name '/NIS' as hidden 3 | 2014-01-14 09:16:25.277830 PST - Discovered configuration for node name '/Search' at path '/Library/Preferences/OpenDirectory/Configurations//Search.plist' 4 | 2014-01-14 09:16:25.277844 PST - Registered node with name '/Search' 5 | 2014-01-14 09:16:25.281339 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/legacy.bundle' 6 | 2014-01-14 09:16:25.284271 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/search.bundle' 7 | 2014-01-14 09:16:26.359479 PST - '/Search' has registered, loading additional services 8 | 2014-01-14 09:16:26.359489 PST - Initialize augmentation support 9 | 2014-01-14 09:16:26.363478 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/SystemCache.bundle' 10 | 2014-01-14 09:16:26.376242 PST - Successfully registered for Kernel identity service requests 11 | 2014-01-14 09:16:26.376261 PST - Adjusting kernel ID cache (100 -> 250) and membership cache (100 -> 500) 12 | 2014-01-14 09:16:26.391021 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/PlistFile.bundle' -------------------------------------------------------------------------------- /docs/source/config/inputs/sandbox.rst: -------------------------------------------------------------------------------- 1 | .. _config_sandbox_input: 2 | 3 | Sandbox Input 4 | ============= 5 | 6 | .. versionadded:: 0.9 7 | 8 | Plugin Name: **SandboxInput** 9 | 10 | The SandboxInput provides a flexible execution environment for data ingestion 11 | and transformation without the need to recompile Heka. Like all other sandboxes 12 | it needs to implement a process_message function. However, it doesn't have to 13 | return until shutdown. If you would like to implement a polling interface 14 | process_message can return zero when complete and it will be called again the 15 | next time TickerInterval fires (if ticker_interval was set to zero it 16 | would simply exit after running once). See :ref:`sandbox`. 17 | 18 | .. _sandboxinput_settings: 19 | 20 | Config: 21 | 22 | - All of the common input configuration parameters are ignored since the data 23 | processing (splitting and decoding) should happen in the plugin. 24 | - :ref:`config_common_sandbox_parameters` 25 | - ``instruction_limit`` is always set to zero for SandboxInputs 26 | 27 | Example 28 | 29 | .. code-block:: ini 30 | 31 | [MemInfo] 32 | type = "SandboxInput" 33 | filename = "meminfo.lua" 34 | 35 | [MemInfo.config] 36 | path = "/proc/meminfo" 37 | 38 | -------------------------------------------------------------------------------- /pipeline/testsupport/sample-hostname.toml: -------------------------------------------------------------------------------- 1 | [hekad] 2 | cpuprof = "/var/log/hekad/cpuprof.log" 3 | max_message_loops = 4 4 | max_process_inject = 10 5 | max_timer_inject = 10 6 | maxprocs = 10 7 | memprof = "/var/log/hekad/memprof.log" 8 | plugin_chansize = 10 9 | poolsize = 100 10 | hostname = "my.example.com" 11 | 12 | [StatsdInput] 13 | address = "127.0.0.1:8125" 14 | ticker_interval = 1 15 | stat_accum_name = "CustomStatAccum" 16 | 17 | [CustomStatAccum] 18 | type = "StatAccumInput" 19 | 20 | [TcpInput] 21 | address = "127.0.0.1:5565" 22 | splitter = "HekaFramingSplitter" 23 | decoder = "ProtobufDecoder" 24 | 25 | [TcpInput2] 26 | type = "TcpInput" 27 | address = "127.0.0.1:5566" 28 | splitter = "TokenSplitter" 29 | 30 | [CounterFilter] 31 | message_matcher = "Type != 'heka.counter-output'" 32 | ticker_interval = 1 33 | 34 | [PayloadEncoder] 35 | 36 | [StatsdFileOutput] 37 | message_matcher = "Type == 'heka.statmetric'" 38 | type = "FileOutput" 39 | path = "log/statsdonly.log" 40 | encoder = "PayloadEncoder" 41 | 42 | [CounterFileOutput] 43 | type = "FileOutput" 44 | path = "log/counter.log" 45 | message_matcher = "Type == 'heka.counter-output'" 46 | 47 | [LogOutput] 48 | message_matcher = "Type == 'heka.counter-output'" 49 | payload_only = true 50 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/filters_row.mustache: -------------------------------------------------------------------------------- 1 | {{Name}} 2 | 3 |
4 |
5 | {{InChanPercent}}% Complete 6 |
7 |
8 | 9 | 10 | {{#hasMatchChannel}} 11 |
12 |
13 | {{MatchChanPercent}}% Complete 14 |
15 |
16 | {{/hasMatchChannel}} 17 | 18 | {{MatchAvgDurationFormatted}} {{MatchAvgDuration.representation}} 19 | {{ProcessMessageCountFormatted}} 20 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/outputs_row.mustache: -------------------------------------------------------------------------------- 1 | {{Name}} 2 | 3 |
4 |
5 | {{InChanPercent}}% Complete 6 |
7 |
8 | 9 | 10 | {{#hasMatchChannel}} 11 |
12 |
13 | {{MatchChanPercent}}% Complete 14 |
15 |
16 | {{/hasMatchChannel}} 17 | 18 | {{MatchAvgDurationFormatted}} {{MatchAvgDuration.representation}} 19 | {{ProcessMessageCountFormatted}} 20 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/alert.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | local alert = require "alert" 6 | 7 | function process_message () 8 | local test = read_message("Timestamp") 9 | local ns = test + 60*61*1e9 10 | 11 | if test == 0 then 12 | assert(alert.send(ns, nil) == false) 13 | assert(alert.send(ns, "") == false) 14 | assert(alert.send_queue(ns) == false) 15 | assert(alert.queue(ns, "alert1")) 16 | assert(alert.queue(ns, "alert2")) 17 | assert(alert.queue(ns, "alert3")) 18 | assert(alert.send_queue(ns)) 19 | assert(alert.send_queue(ns * 2) == false) 20 | elseif test == 1 then 21 | assert(alert.throttled(ns)) 22 | assert(alert.send(ns, "alert4") == false) 23 | alert.set_throttle(10) 24 | ns = ns + 11 25 | assert(alert.send(ns, "alert5")) 26 | assert(alert.send(ns, "alert6") == false) 27 | elseif test == 2 then 28 | assert(alert.send(ns, "alert7") == false) 29 | assert(alert.send(0, "alert8")) 30 | end 31 | return 0 32 | end 33 | -------------------------------------------------------------------------------- /plugins/docker/client.go: -------------------------------------------------------------------------------- 1 | package docker 2 | 3 | import "github.com/fsouza/go-dockerclient" 4 | 5 | type DockerClient interface { 6 | // AddEventListener adds a new listener to container events in the Docker 7 | // API. 8 | // 9 | // The parameter is a channel through which events will be sent. 10 | AddEventListener(listener chan<- *docker.APIEvents) error 11 | 12 | // RemoveEventListener removes a listener from the monitor. 13 | RemoveEventListener(listener chan *docker.APIEvents) error 14 | 15 | // ListContainersOptions specify parameters to the ListContainers function. 16 | // 17 | // See http://goo.gl/XqtcyU for more details. 18 | ListContainers(opts docker.ListContainersOptions) ([]docker.APIContainers, error) 19 | 20 | // InspectContainer returns information about a container by its ID. 21 | // 22 | // See http://goo.gl/CxVuJ5 for more details. 23 | InspectContainer(id string) (*docker.Container, error) 24 | 25 | // AttachToContainer attaches to a container, using the given options. 26 | // 27 | // See http://goo.gl/RRAhws for more details. 28 | AttachToContainer(opts docker.AttachToContainerOptions) error 29 | 30 | // Ping pings the docker server 31 | // 32 | // See https://goo.gl/kQCfJj for more details. 33 | Ping() error 34 | } 35 | -------------------------------------------------------------------------------- /docs/source/config/outputs/index_noref.rst: -------------------------------------------------------------------------------- 1 | 2 | ======= 3 | Outputs 4 | ======= 5 | 6 | .. include:: /config/outputs/index.rst 7 | :start-after: _config_common_output_parameters 8 | :end-before: Available Output Plugins 9 | 10 | .. include:: /config/outputs/amqp.rst 11 | :start-line: 1 12 | 13 | .. include:: /config/outputs/carbon.rst 14 | :start-line: 1 15 | 16 | .. include:: /config/outputs/dashboard.rst 17 | :start-line: 1 18 | 19 | .. include:: /config/outputs/elasticsearch.rst 20 | :start-line: 1 21 | 22 | .. include:: /config/outputs/file.rst 23 | :start-line: 1 24 | 25 | .. include:: /config/outputs/http.rst 26 | :start-line: 1 27 | 28 | .. include:: /config/outputs/irc.rst 29 | :start-line: 1 30 | 31 | .. include:: /config/outputs/kafka.rst 32 | :start-line: 1 33 | 34 | .. include:: /config/outputs/log.rst 35 | :start-line: 1 36 | 37 | .. include:: /config/outputs/nagios.rst 38 | :start-line: 1 39 | 40 | .. include:: /config/outputs/sandbox.rst 41 | :start-line: 1 42 | 43 | .. include:: /config/outputs/smtp.rst 44 | :start-line: 1 45 | 46 | .. include:: /config/outputs/tcp.rst 47 | :start-line: 1 48 | 49 | .. include:: /config/outputs/udp.rst 50 | :start-line: 1 51 | 52 | .. include:: /config/outputs/whisper.rst 53 | :start-line: 1 54 | -------------------------------------------------------------------------------- /docs/source/config/inputs/index_noref.rst: -------------------------------------------------------------------------------- 1 | 2 | ====== 3 | Inputs 4 | ====== 5 | 6 | .. include:: /config/inputs/index.rst 7 | :start-after: _config_common_input_parameters: 8 | :end-before: Available Input Plugins 9 | 10 | .. include:: /config/inputs/amqp.rst 11 | :start-line: 1 12 | 13 | .. include:: /config/inputs/docker_event.rst 14 | :start-line: 1 15 | 16 | .. include:: /config/inputs/docker_log.rst 17 | :start-line: 1 18 | 19 | .. include:: /config/inputs/file_polling.rst 20 | :start-line: 1 21 | 22 | .. include:: /config/inputs/http.rst 23 | :start-line: 1 24 | 25 | .. include:: /config/inputs/httplisten.rst 26 | :start-line: 1 27 | 28 | .. include:: /config/inputs/kafka.rst 29 | :start-line: 1 30 | 31 | .. include:: /config/inputs/logstreamer.rst 32 | :start-line: 1 33 | 34 | .. include:: /config/inputs/process.rst 35 | :start-line: 1 36 | 37 | .. include:: /config/inputs/processdir.rst 38 | :start-line: 1 39 | 40 | .. include:: /config/inputs/sandbox.rst 41 | :start-line: 1 42 | 43 | .. include:: /config/inputs/stataccum.rst 44 | :start-line: 1 45 | 46 | .. include:: /config/inputs/statsd.rst 47 | :start-line: 1 48 | 49 | .. include:: /config/inputs/tcp.rst 50 | :start-line: 1 51 | 52 | .. include:: /config/inputs/udp.rst 53 | :start-line: 1 54 | 55 | -------------------------------------------------------------------------------- /plugins/testsupport/test-zeus-incomplete.log: -------------------------------------------------------------------------------- 1 | 10.1.1.2 plinko-31.byzantium.mozilla.com user1 [15/Mar/2013:12:20:27 -0700] "GET /1.1/user1/storage/passwords?full=1&newer=1355973234.140 HTTP/1.1" 200 233 "-" "Firefox AndroidSync 1.20.0.1.0 (Firefox)" "-" "ssl: SSL_RSA_WITH_RC4_128_SHA, version=TLSv1, bits=128" node_s:0.080575 req_s:0.080575 retries:0 req_b:327 "c_l:-" 2 | 10.1.1.3 plinko-1270.byzantium.mozilla.com user2 [15/Mar/2013:12:20:27 -0700] "POST /1.1/user2/storage/tabs HTTP/1.1" 200 280 "-" "Firefox/20.0.1 FxSync/1.22.0.201304.desktop" "-" "ssl: SSL_RSA_WITH_RC4_128_SHA, version=TLSv1, bits=128" node_s:0.020249 req_s:0.020249 retries:0 req_b:1034 "c_l:528" 3 | 10.1.1.4 plinko-565.byzantium.mozilla.com user3 [15/Mar/2013:12:20:27 -0700] "POST /1.1/user3/storage/clients HTTP/1.1" 200 280 "-" "Firefox/20.0.1 FxSync/1.22.0.201304.desktop" "-" "ssl: SSL_RSA_WITH_RC4_128_SHA, version=TLSv1, bits=128" node_s:0.157255 req_s:0.157255 retries:0 req_b:781 "c_l:273" 4 | 10.1.1.4 plinko-565.byzantium.mozilla.com user3 [15/Mar/2013:12:20:27 -0700] "GET /1.1/user3/storage/passwords?newer=1356237662.44&full=1 HTTP/1.1" 200 1396 "-" "Firefox/20.0.1 FxSync/1.22.0.201304.desktop" "-" "ssl: SSL_RSA_WITH_RC4_128_SHA, version=TLSv1, bits=128" node_s:0.047167 req_s:0.047167 retries:0 req_b:446 "c_l:-" 5 | 10.1.1.4 plinko-565.byzantium.mozilla.com user3 -------------------------------------------------------------------------------- /sandbox/lua/testsupport/decoder.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | require("lpeg") 6 | local l = lpeg 7 | l.locale(l) 8 | 9 | local space = l.space^1 10 | 11 | local timestamp = l.Cg((l.R"09"^1 / "%0000000000"), "Timestamp") 12 | 13 | local severity = l.Cg( 14 | l.P"debug" /"7" 15 | + l.P"info" /"6" 16 | + l.P"notice" /"5" 17 | + (l.P"warning" + "warn")/"4" 18 | + (l.P"error" + "err") /"3" 19 | + l.P"crit" /"2" 20 | + l.P"alert" /"1" 21 | + (l.P"emerg" + "panic") /"0" 22 | , "Severity") 23 | 24 | local key = l.C(l.alpha^1) 25 | 26 | local value = l.C(l.R"!~"^1) 27 | 28 | local pair = space * l.Cg(key * "=" * value) 29 | 30 | local fields = l.Cg(l.Cf(l.Ct("") * pair^0, rawset), "Fields") 31 | 32 | local grammar = l.Ct(timestamp * space * severity * fields) 33 | 34 | function process_message () 35 | local payload = read_message("Payload") 36 | local t = grammar:match(payload) 37 | if t then 38 | inject_message(t) 39 | else 40 | return -1, "LPeg grammar failed to match" 41 | end 42 | return 0 43 | end 44 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/field_scribble.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | function process_message () 6 | write_message("Type", "MyType") 7 | write_message("Logger", "MyLogger") 8 | write_message("Timestamp", "2013-12-02T07:21:54.904958136Z") 9 | write_message("Payload", "MyPayload") 10 | write_message("EnvVersion", "000") 11 | write_message("Hostname", "MyHostname") 12 | write_message("Severity", 4) 13 | write_message("Pid", "12345") 14 | write_message("Fields[String]", "foo") 15 | write_message("Fields[Float]", 1.2345) 16 | write_message("Fields[Int]", 123, "count", 0, 0) 17 | write_message("Fields[Int]", 456, "count", 0, 1) 18 | write_message("Fields[Bool]", true) 19 | write_message("Fields[Bool]", false, "", 1, 0) 20 | write_message("Fields[Bool]", false, "", 1, 0) 21 | write_message("Fields[]", "bad idea") 22 | write_message("Uuid", "550d19b9-58c7-49d8-b0dd-b48cd1c5b305") 23 | -- Added and removed, tests verify deletion. 24 | write_message("Fields[delete]", "foo") 25 | write_message("Fields[delete]", nil) 26 | -- Deleting a non-existent field doesn't cause an error. 27 | write_message("Fields[nonexistent]", nil) 28 | return 0 29 | end 30 | -------------------------------------------------------------------------------- /dasher/javascript/presenters/sandbox_output_presenter.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "underscore" 4 | ], 5 | function(_) { 6 | "use strict"; 7 | 8 | /** 9 | * Presents a SandboxOutput for use in a view. 10 | * 11 | * @class SandboxOutputPresenter 12 | * @extends SandboxOutput 13 | * 14 | * @constructor 15 | * 16 | * @param {SandboxOutput} sandboxOutput SandboxOutput to be presented. 17 | */ 18 | var SandboxOutputPresenter = function (sandboxOutput) { 19 | _.extend(this, sandboxOutput.attributes); 20 | }; 21 | 22 | _.extend(SandboxOutputPresenter.prototype, { 23 | /** 24 | * Filename without the leading `data/`. 25 | * 26 | * @method ShortFilename 27 | * @return {String} shortened Filename 28 | */ 29 | ShortFilename: function() { 30 | return this.Filename.replace(/^data\//, ""); 31 | }, 32 | 33 | /** 34 | * Type of sandbox output based on the file extension. 35 | * 36 | * @method Type 37 | * @return {String} Uppercase file extension 38 | */ 39 | Type: function() { 40 | var match = this.Filename.match(/\.([a-z]+)$/); 41 | 42 | if (match) { 43 | return match[1].toUpperCase(); 44 | } 45 | } 46 | }); 47 | 48 | return SandboxOutputPresenter; 49 | } 50 | ); 51 | -------------------------------------------------------------------------------- /pipeline/doc.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Ben Bangert (bbangert@mozilla.com) 12 | # Rob Miller (rmiller@mozilla.com) 13 | # 14 | # ***** END LICENSE BLOCK *****/ 15 | 16 | /* 17 | 18 | The `pipeline` package implements the `hekad` daemon's main message processing 19 | pipeline. It defines interface specifications for plugins in general, and for 20 | all of the various specific plugin types (i.e. Input, Decoder, Filter, and 21 | Output), as well as implementations of a number of plugins of each type. It 22 | also defines and provides a variety of interfaces through which plugins can 23 | interact with the Heka environment. 24 | 25 | For more information about Heka please see the following resources: 26 | 27 | * Heka project documentation: http://heka-docs.readthedocs.org/ 28 | * `hekad` daemon documenation: http://hekad.readthedocs.org/ 29 | * `hekad` github project: https://github.com/mozilla-services/heka 30 | 31 | */ 32 | package pipeline 33 | -------------------------------------------------------------------------------- /dasher/javascript/models/sandbox.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "backbone", 4 | "deepModel" 5 | ], 6 | function(Backbone) { 7 | "use strict"; 8 | 9 | /** 10 | * Sandbox model representing data generated from sandbox plugins. 11 | * 12 | * @class Sandbox 13 | * 14 | * @constructor 15 | */ 16 | var Sandbox = Backbone.DeepModel.extend({ 17 | /** 18 | * Finds sandbox output by its short filename. 19 | * 20 | * @method findOutputByShortFilename 21 | * 22 | * @param {String} shortFilename Filename without `data/`. 23 | */ 24 | findOutputByShortFilename: function(shortFilename) { 25 | var fileName = "data/" + shortFilename; 26 | var sandboxOutput; 27 | 28 | this.get("Outputs").forEach(function(o) { 29 | if (o.get("Filename") === fileName) { 30 | sandboxOutput = o; 31 | } 32 | }); 33 | 34 | return sandboxOutput; 35 | } 36 | }); 37 | 38 | /** 39 | * Unique identifier for the sandbox (same as `Name`). 40 | * 41 | * @property {String} id 42 | */ 43 | 44 | /** 45 | * Name of the sandbox. 46 | * 47 | * @property {String} Name 48 | */ 49 | 50 | /** 51 | * Outputs in the sandbox. 52 | * 53 | * @property {Backbone.Collection} outputs 54 | */ 55 | 56 | return Sandbox; 57 | } 58 | ); 59 | -------------------------------------------------------------------------------- /docs/source/config/decoders/stats_to_fields.rst: -------------------------------------------------------------------------------- 1 | .. _config_statstofieldsdecoder: 2 | 3 | Stats To Fields Decoder 4 | ======================= 5 | 6 | .. versionadded:: 0.4 7 | 8 | Plugin Name: **StatsToFieldsDecoder** 9 | 10 | The StatsToFieldsDecoder will parse time series statistics data in the 11 | `graphite message format `_ and encode the data into the message fields, in the same 13 | format produced by a :ref:`config_stat_accum_input` plugin with the 14 | `emit_in_fields` value set to true. This is useful if you have externally 15 | generated graphite string data flowing through Heka that you'd like to process 16 | without having to roll your own string parsing code. 17 | 18 | This decoder has no configuration options. It simply expects to be passed 19 | messages with statsd string data in the payload. Incorrect or malformed 20 | content will cause a decoding error, dropping the message. 21 | 22 | The fields format only contains a single "timestamp" field, so any payloads 23 | containing multiple timestamps will end up generating a separate message for 24 | each timestamp. Extra messages will be a copy of the original message except 25 | a) the payload will be empty and b) the unique timestamp and related stats 26 | will be the only message fields. 27 | 28 | Example: 29 | 30 | .. code-block:: ini 31 | 32 | [StatsToFieldsDecoder] 33 | -------------------------------------------------------------------------------- /plugins/utils.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # Mike Trinkala (trink@mozilla.com) 13 | # 14 | # ***** END LICENSE BLOCK *****/ 15 | 16 | package plugins 17 | 18 | import ( 19 | "fmt" 20 | "io/ioutil" 21 | "os" 22 | "strings" 23 | ) 24 | 25 | func CheckWritePermission(fp string) (err error) { 26 | var file *os.File 27 | if file, err = ioutil.TempFile(fp, ".hekad.perm_check"); err == nil { 28 | errMsgs := make([]string, 0, 3) 29 | var e error 30 | if _, e = file.WriteString("ok"); e != nil { 31 | errMsgs = append(errMsgs, "can't write to test file") 32 | } 33 | if e = file.Close(); e != nil { 34 | errMsgs = append(errMsgs, "can't close test file") 35 | } 36 | if e = os.Remove(file.Name()); e != nil { 37 | errMsgs = append(errMsgs, "can't remove test file") 38 | } 39 | if len(errMsgs) > 0 { 40 | err = fmt.Errorf("errors: %s", strings.Join(errMsgs, ", ")) 41 | } 42 | } 43 | return 44 | } 45 | -------------------------------------------------------------------------------- /plugins/testsupport/test-severity.log: -------------------------------------------------------------------------------- 1 | severity: info 2 | severity: emergency 3 | severity: debug 4 | severity: notice 5 | severity: critical 6 | severity: error 7 | severity: warning 8 | severity: alert 9 | severity: critical 10 | severity: alert 11 | severity: info 12 | severity: debug 13 | severity: emergency 14 | severity: error 15 | severity: notice 16 | severity: warning 17 | severity: info 18 | severity: emergency 19 | severity: debug 20 | severity: notice 21 | severity: critical 22 | severity: error 23 | severity: warning 24 | severity: alert 25 | severity: critical 26 | severity: alert 27 | severity: info 28 | severity: debug 29 | severity: emergency 30 | severity: error 31 | severity: notice 32 | severity: warning 33 | severity: info 34 | severity: BOGUS 35 | severity: emergency 36 | severity: debug 37 | severity: notice 38 | severity: critical 39 | severity: error 40 | severity: warning 41 | severity: alert 42 | severity: critical 43 | severity: alert 44 | severity: info 45 | severity: debug 46 | severity: emergency 47 | severity: error 48 | severity: notice 49 | severity: warning 50 | severity: info 51 | severity: emergency 52 | severity: debug 53 | severity: notice 54 | severity: critical 55 | severity: error 56 | severity: warning 57 | severity: alert 58 | severity: critical 59 | severity: alert 60 | severity: info 61 | severity: debug 62 | severity: emergency 63 | severity: error 64 | severity: notice 65 | severity: warning -------------------------------------------------------------------------------- /client/client.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012-2014 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # Mike Trinkala (trink@mozilla.com) 13 | # 14 | # ***** END LICENSE BLOCK *****/ 15 | 16 | /* 17 | 18 | Client package to talk to heka from Go. 19 | 20 | */ 21 | package client 22 | 23 | import ( 24 | "github.com/mozilla-services/heka/message" 25 | "log" 26 | "os" 27 | ) 28 | 29 | var ( 30 | LogInfo = log.New(os.Stdout, "", log.LstdFlags) 31 | LogError = log.New(os.Stderr, "", log.LstdFlags) 32 | ) 33 | 34 | type Client struct { 35 | Sender Sender 36 | Encoder StreamEncoder 37 | buf []byte 38 | } 39 | 40 | func NewClient(sender Sender, encoder StreamEncoder) (self *Client) { 41 | self = &Client{Sender: sender, Encoder: encoder} 42 | return 43 | } 44 | 45 | func (self *Client) SendMessage(msg *message.Message) (err error) { 46 | err = self.Encoder.EncodeMessageStream(msg, &self.buf) 47 | if err == nil { 48 | err = self.Sender.SendMessage(self.buf) 49 | } 50 | return 51 | } 52 | -------------------------------------------------------------------------------- /dasher/javascript/lib/termination_report.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "underscore", 4 | "crc32" 5 | ], 6 | function(_, crc32) { 7 | "use strict"; 8 | 9 | /** 10 | * Termination report data container. 11 | * 12 | * @class TerminationReport 13 | * 14 | * @constructor 15 | */ 16 | var TerminationReport = function() { 17 | /** 18 | * Data 19 | * 20 | * @property {Object[]} data 21 | */ 22 | this.data = []; 23 | }; 24 | 25 | /** 26 | * Parses termination report from tsv. 27 | * 28 | * @method parse 29 | * 30 | * @param {String} input Tab delimited termination report data 31 | * 32 | * @return {TerminationReport} 33 | * @static 34 | */ 35 | TerminationReport.parse = function(input) { 36 | var terminatationReport = new TerminationReport(); 37 | var lines = input.split("\n"); 38 | 39 | _.each(lines, function(line) { 40 | if (line.length > 0) { 41 | var fields = line.split("\t"); 42 | 43 | terminatationReport.data.push({ 44 | id: crc32(fields[0] + fields[1] + fields[2]), 45 | time: new Date(parseInt(fields[0], 10) * 1000), 46 | plugin: fields[1], 47 | message: fields[2] 48 | }); 49 | } 50 | }); 51 | 52 | return terminatationReport; 53 | }; 54 | 55 | return TerminationReport; 56 | } 57 | ); 58 | -------------------------------------------------------------------------------- /docs/source/developing/release.rst: -------------------------------------------------------------------------------- 1 | .. _release: 2 | 3 | ==================== 4 | Heka release process 5 | ==================== 6 | 7 | This document contains a description of the steps taken to make a release 8 | of the Heka server. 9 | 10 | #. Review intended release branch for correct version number (in 11 | `cmd/hekad/main.go`, `docs/source/conf.py`, and `CMakeLists.txt`) and 12 | updated changelog (`CHANGES.txt`) and verify that the build succeeds and 13 | all tests pass. 14 | 15 | #. Tag verified commit on intended release branch with appropriate version 16 | tag. 17 | 18 | #. If this release is the highest released version number to date, the 19 | verified commit should be merged into the master branch. 20 | 21 | #. If there have been any changes made on the release branch that should also 22 | be applied to the dev branch, those changes should be merged into the dev 23 | branch. 24 | 25 | #. Bump version number (in `cmd/hekad/main.go`, `docs/source/conf.py`, and 26 | `CMakeLists.txt`) and add section for future release to changelog 27 | (`CHANGES.txt`). Commit "version bump" revision to the released version 28 | branch and push. 29 | 30 | #. Build all required binary packages. 31 | 32 | #. Create new github release (https://github.com/mozilla- 33 | services/heka/releases) and upload generated binaries. 34 | 35 | #. Visit readthedocs.org admin site, build all relevant docs, set appropriate 36 | defaults. 37 | -------------------------------------------------------------------------------- /dasher/javascript/views/termination_report/termination_report_index.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "hgn!templates/termination_report/termination_report_index", 5 | "adapters/termination_report_adapter", 6 | "presenters/termination_report_row_presenter" 7 | ], 8 | function(BaseView, TerminationReportIndexTemplate, TerminationReportAdapter, TerminationReportRowPresenter) { 9 | "use strict"; 10 | 11 | /** 12 | * Index view for sandboxes. This is a top level view that's loaded by the router. 13 | * 14 | * @class TerminationReportIndex 15 | * @extends BaseView 16 | * 17 | * @constructor 18 | */ 19 | var TerminationReportIndex = BaseView.extend({ 20 | presenter: TerminationReportRowPresenter, 21 | template: TerminationReportIndexTemplate, 22 | 23 | initialize: function() { 24 | this.adapter = new TerminationReportAdapter(); 25 | this.collection = this.adapter.terminationReportCollection; 26 | 27 | this.listenTo(this.collection, "add remove reset change", this.render, this); 28 | 29 | this.adapter.fill(); 30 | }, 31 | 32 | /** 33 | * Stops polling for updates before being destroyed. 34 | * 35 | * @method beforeDestroy 36 | */ 37 | beforeDestroy: function() { 38 | this.adapter.stopPollingForUpdates(); 39 | } 40 | }); 41 | 42 | return TerminationReportIndex; 43 | } 44 | ); 45 | -------------------------------------------------------------------------------- /docs/source/sandbox/encoder.rst: -------------------------------------------------------------------------------- 1 | .. _sandboxencoder: 2 | 3 | .. include:: ../config/encoders/sandbox.rst 4 | :start-line: 1 5 | 6 | .. _sandboxencoders: 7 | 8 | Available Sandbox Encoders 9 | -------------------------- 10 | 11 | Alert Encoder 12 | ^^^^^^^^^^^^^ 13 | .. include:: /../../sandbox/lua/encoders/alert.lua 14 | :start-after: --[[ 15 | :end-before: --]] 16 | 17 | CBUF Librato Encoder 18 | ^^^^^^^^^^^^^^^^^^^^ 19 | .. include:: /../../sandbox/lua/encoders/cbuf_librato.lua 20 | :start-after: --[[ 21 | :end-before: --]] 22 | 23 | ESPayloadEncoder 24 | ^^^^^^^^^^^^^^^^ 25 | .. include:: /../../sandbox/lua/encoders/es_payload.lua 26 | :start-after: --[[ 27 | :end-before: --]] 28 | 29 | Schema Carbon Line Encoder 30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 31 | .. include:: /../../sandbox/lua/encoders/schema_carbon_line.lua 32 | :start-after: --[=[ 33 | :end-before: --]=] 34 | 35 | Schema InfluxDB Encoder 36 | ^^^^^^^^^^^^^^^^^^^^^^^ 37 | .. include:: /../../sandbox/lua/encoders/schema_influx.lua 38 | :start-after: --[=[ 39 | :end-before: --]=] 40 | 41 | Schema InfluxDB Line Encoder 42 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 43 | .. include:: /../../sandbox/lua/encoders/schema_influx_line.lua 44 | :start-after: --[=[ 45 | :end-before: --]=] 46 | 47 | Statmetric Influx Encoder 48 | ^^^^^^^^^^^^^^^^^^^^^^^^^ 49 | .. include:: /../../sandbox/lua/encoders/statmetric_influx.lua 50 | :start-after: --[=[ 51 | :end-before: --]=] 52 | -------------------------------------------------------------------------------- /ringbuf/ringbuf_test.go: -------------------------------------------------------------------------------- 1 | package ringbuf 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | ) 7 | 8 | const ( 9 | doRead = iota 10 | doWrite 11 | ) 12 | 13 | type rbtest struct { 14 | op int 15 | data string 16 | bufSize int 17 | ret int 18 | totalSize int 19 | } 20 | 21 | func TestRingbuf(t *testing.T) { 22 | r := New(5) 23 | 24 | tab := []rbtest{ 25 | {doWrite, "abc", 0, 3, 3}, 26 | {doWrite, "d", 0, 1, 4}, 27 | {doRead, "abcd", 4, 4, 4}, 28 | {doWrite, "ef", 0, 2, 5}, 29 | {doRead, "bcdef", 5, 5, 5}, 30 | {doWrite, "abcdefg", 0, 5, 5}, 31 | {doWrite, "fg", 0, 2, 5}, 32 | {doRead, "efgfg", 5, 5, 5}, 33 | {doWrite, "abracadabra", 0, 11, 5}, 34 | {doRead, "dabra", 5, 5, 5}, 35 | } 36 | 37 | for _, step := range tab { 38 | switch step.op { 39 | case doRead: 40 | b := make([]byte, step.bufSize) 41 | n := r.Read(b) 42 | t.Logf("r.Read(%d) = %d, %#v", step.bufSize, step.ret, string(b[:n])) 43 | if n != step.ret { 44 | t.Errorf("r.Read(%#v) = %d, want %d", b, n, step.ret) 45 | } 46 | if !bytes.Equal(b[:n], []byte(step.data)) { 47 | t.Errorf("b = %#v, want %#v", string(b[:n]), step.data) 48 | } 49 | 50 | case doWrite: 51 | r.Write([]byte(step.data)) 52 | t.Logf("r.Write(%#v) = %d", string(step.data), step.ret) 53 | } 54 | if r.Size() != step.totalSize { 55 | t.Errorf("r.Size() = %d, want %d", r.Size(), step.totalSize) 56 | } 57 | t.Logf("%#v", r) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Heka 2 | 3 | Data Acquisition and Processing Made Easy 4 | 5 | Heka is a tool for collecting and collating data from a number of different 6 | sources, performing "in-flight" processing of collected data, and delivering 7 | the results to any number of destinations for further analysis. 8 | 9 | Heka is written in [Go](http://golang.org/), but Heka plugins can be written 10 | in either Go or [Lua](http://lua.org). The easiest way to compile Heka is by 11 | sourcing (see below) the build script in the root directory of the project, 12 | which will set up a Go environment, verify the prerequisites, and install all 13 | required dependencies. The build process also provides a mechanism for easily 14 | integrating external plug-in packages into the generated `hekad`. For more 15 | details and additional installation options see 16 | [Installing](https://hekad.readthedocs.org/en/latest/installing.html). 17 | 18 | WARNING: YOU MUST *SOURCE* THE BUILD SCRIPT (i.e. `source build.sh`) TO 19 | BUILD HEKA. Setting up the Go build environment requires changes to 20 | the shell environment, if you simply execute the script (i.e. 21 | `./build.sh`) these changes will not be made. 22 | 23 | Resources: 24 | * Heka project docs: http://hekad.readthedocs.org/ 25 | * GoDoc package docs: http://godoc.org/github.com/mozilla-services/heka 26 | * Mailing list: https://mail.mozilla.org/listinfo/heka 27 | * IRC: #heka on irc.mozilla.org 28 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/json_payload_transform_sr.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | require "cjson" 6 | require "string" 7 | -- sample input {"name":"android_app_created","created_at":"2013-11-15 22:37:34.709739275"} 8 | 9 | local date_pattern = '("created_at":)"(%d+-%d+-%d+) (%d+:%d+:%d+%.%d+)"' 10 | 11 | function process_message () 12 | local pl = read_message("Payload") 13 | local json, cnt = string.gsub(pl, date_pattern, '%1"%2T%3Z"', 1) 14 | if cnt == 0 then 15 | return -1 16 | end 17 | 18 | inject_payload("json", "transformed timestamp S&R", cjson.encode(json)) 19 | return 0 20 | end 21 | 22 | -- sample output 23 | --2013/11/18 09:20:41 < 24 | -- Timestamp: 2013-11-18 09:20:41.252096692 -0800 PST 25 | -- Type: logfile 26 | -- Hostname: trink-x230 27 | -- Pid: 0 28 | -- UUID: e8298865-fbc2-422c-873e-1210ce8efd9f 29 | -- Logger: test.log 30 | -- Payload: {"name":"android_app_created","created_at":"2013-11-15T22:37:34.709739275Z"} 31 | -- 32 | -- EnvVersion: 0.8 33 | -- Severity: 0 34 | -- Fields: [name:"payload_type" value_type:STRING representation:"file-extension" value_string:"json" name:"payload_name" value_type:STRING representation:"" value_string:"transformed timestamp" ] 35 | 36 | 37 | -------------------------------------------------------------------------------- /dasher/javascript/views/health/channel_count_widget.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "views/base_view", 4 | "presenters/plugin_presenter", 5 | "hgn!templates/health/channel_count_widget" 6 | ], 7 | function(BaseView, PluginPresenter, ChannelCountWidgetTemplate) { 8 | "use strict"; 9 | 10 | /** 11 | * Widget for displaying channel counts. 12 | * 13 | * @class ChannelCountWidget 14 | * @extends BaseView 15 | * 16 | * @constructor 17 | */ 18 | var ChannelCountWidget = BaseView.extend({ 19 | presenter: PluginPresenter, 20 | template: ChannelCountWidgetTemplate, 21 | 22 | initialize: function() { 23 | this.listenTo(this.model, "change:InChanLength.value", this.render, this); 24 | this.listenTo(this.model, "change:InChanCapacity.value", this.render, this); 25 | }, 26 | 27 | /** 28 | * Efficiently updates the in channel length. 29 | * 30 | * @method updateInChanLength 31 | */ 32 | updateInChanLength: function() { 33 | this.$(".in-chan-length").html(this.model.get("InChanLength.value")); 34 | }, 35 | 36 | /** 37 | * Efficiently updates the in channel capacity. 38 | * 39 | * @method updateInChanCapacity 40 | */ 41 | updateInChanCapacity: function() { 42 | this.$(".in-chan-capacity").html(this.model.get("InChanCapacity.value")); 43 | } 44 | }); 45 | 46 | return ChannelCountWidget; 47 | } 48 | ); 49 | -------------------------------------------------------------------------------- /docs/source/config/splitters/token.rst: -------------------------------------------------------------------------------- 1 | .. _config_token_splitter: 2 | 3 | Token Splitter 4 | ============== 5 | 6 | Plugin Name: **TokenSplitter** 7 | 8 | A TokenSplitter is used to split an incoming data stream on every occurrence 9 | (or every Nth occurrence) of a single, one byte token character. The token 10 | will be included as the final character in the returned record. 11 | 12 | A default configuration of the TokenSplitter (i.e. splitting on every newline) 13 | is automatically registered as an available splitter plugin as 14 | "TokenSplitter", so additional TOML sections don't need to be added unless you 15 | want to use different settings. 16 | 17 | Config: 18 | 19 | - delimiter (string, optional): 20 | String representation of the byte token to be used as message delimiter. 21 | Defaults to `"\\n"`. 22 | 23 | - count (uint, optional): 24 | Number of instances of the delimiter that should be encountered before 25 | returning a record. Defaults to 1. Setting to 0 has no effect, 0 and 1 26 | will be treated identically. Often used in conjunction with the 27 | :ref:`deliver_incomplete_final ` 28 | option set to true, to ensure trailing partial records are still 29 | delivered. 30 | 31 | Example: 32 | 33 | .. code-block:: ini 34 | 35 | [split_on_space] 36 | type = "TokenSplitter" 37 | delimiter = " " 38 | 39 | [split_every_50th_newline_keep_partial] 40 | type = "TokenSplitter" 41 | count = 50 42 | deliver_incomplete_final = true 43 | -------------------------------------------------------------------------------- /dasher/javascript/collections/plugins.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "backbone", 4 | "models/plugin" 5 | ], 6 | function(Backbone, Plugin) { 7 | "use strict"; 8 | 9 | /** 10 | * Plugins collection. 11 | * 12 | * @class Plugins 13 | * @constructor 14 | */ 15 | var Plugins = Backbone.Collection.extend({ 16 | model: Plugin, 17 | 18 | /** 19 | * Gets the Router plugin from the collection. 20 | * 21 | * @method getRouter 22 | * 23 | * @return {Plugin} Router plugin 24 | */ 25 | getRouter: function() { 26 | return this.findWhere({ id: "Router" }); 27 | }, 28 | 29 | /** 30 | * Gets the InputRecycleChan plugin from the collection. 31 | * 32 | * @method getInputRecycleChan 33 | * 34 | * @return {Plugin} InputRecycleChan plugin 35 | */ 36 | getInputRecycleChan: function() { 37 | return this.findWhere({ id: "inputRecycleChan" }); 38 | }, 39 | 40 | /** 41 | * Gets the InjectRecycleChan plugin from the collection. 42 | * 43 | * @method getInjectRecycleChan 44 | * 45 | * @return {Plugin} InjectRecycleChan plugin 46 | */ 47 | getInjectRecycleChan: function() { 48 | return this.findWhere({ id: "injectRecycleChan" }); 49 | }, 50 | 51 | comparator: function(collection) { 52 | return(collection.get('Name')); 53 | } 54 | }); 55 | 56 | return Plugins; 57 | } 58 | ); 59 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/counter.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | require "string" 6 | require "table" 7 | require "os" 8 | 9 | lastTime = os.time() * 1e9 10 | lastCount = 0 11 | count = 0 12 | rate = 0.0 13 | rates = {} 14 | 15 | function process_message () 16 | count = count + 1 17 | return 0 18 | end 19 | 20 | 21 | function timer_event(ns) 22 | local msgsSent = count - lastCount 23 | if msgsSent == 0 then return end 24 | 25 | local elapsedTime = ns - lastTime 26 | if elapsedTime == 0 then return end 27 | 28 | lastCount = count 29 | lastTime = ns 30 | rate = msgsSent / (elapsedTime / 1e9) 31 | rates[#rates+1] = rate 32 | inject_payload("txt", "", 33 | string.format("Got %d messages. %0.2f msg/sec", count, rate)) 34 | 35 | local samples = #rates 36 | if samples == 10 then -- generate a summary every 10 samples 37 | table.sort(rates) 38 | local min = rates[1] 39 | local max = rates[samples] 40 | local sum = 0 41 | for i, val in ipairs(rates) do 42 | sum = sum + val 43 | end 44 | inject_payload("txt", "", 45 | string.format("AGG Sum. Min: %0.2f Max: %0.2f Mean: %0.2f", min, max, sum/samples)) 46 | rates = {} 47 | end 48 | end 49 | 50 | -------------------------------------------------------------------------------- /docs/source/config/outputs/udp.rst: -------------------------------------------------------------------------------- 1 | .. _config_udp_output: 2 | 3 | UDP Output 4 | ========== 5 | 6 | .. versionadded:: 0.7 7 | 8 | Plugin Name: **UdpOutput** 9 | 10 | Output plugin that delivers Heka message data to a specified UDP or Unix 11 | datagram socket location. 12 | 13 | Config: 14 | 15 | - net (string, optional): 16 | Network type to use for communication. Must be one of "udp", "udp4", 17 | "udp6", or "unixgram". "unixgram" option only available on systems that 18 | support Unix datagram sockets. Defaults to "udp". 19 | - address (string): 20 | Address to which we will be sending the data. Must be IP:port for net 21 | types of "udp", "udp4", or "udp6". Must be a path to a Unix datagram 22 | socket file for net type "unixgram". 23 | - local_address (string, optional): 24 | Local address to use on the datagram packets being generated. Must be 25 | IP:port for net types of "udp", "udp4", or "udp6". Must be a path to a 26 | Unix datagram socket file for net type "unixgram". 27 | - encoder (string): 28 | Name of registered encoder plugin that will extract and/or serialized data 29 | from the Heka message. 30 | - max_message_size (int): 31 | Maximum size of message that is allowed to be sent via UdpOutput. Messages 32 | which exceed this limit will be dropped. Defaults to 65507 (the limit 33 | for UDP packets in IPv4). 34 | 35 | Example: 36 | 37 | .. code-block:: ini 38 | 39 | [PayloadEncoder] 40 | 41 | [UdpOutput] 42 | address = "myserver.example.com:34567" 43 | encoder = "PayloadEncoder" 44 | -------------------------------------------------------------------------------- /cmake/FindGo.cmake: -------------------------------------------------------------------------------- 1 | # This Source Code Form is subject to the terms of the Mozilla Public 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | # The module defines the following variables: 6 | # GO_FOUND - true if the Go was found 7 | # GO_EXECUTABLE - path to the executable 8 | # GO_VERSION - Go version number 9 | # GO_PLATFORM - i.e. linux 10 | # GO_ARCH - i.e. amd64 11 | # Example usage: 12 | # find_package(Go 1.2 REQUIRED) 13 | 14 | 15 | find_program(GO_EXECUTABLE go PATHS ENV GOROOT GOPATH GOBIN PATH_SUFFIXES bin) 16 | if (GO_EXECUTABLE) 17 | execute_process(COMMAND ${GO_EXECUTABLE} version OUTPUT_VARIABLE GO_VERSION_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE) 18 | if(GO_VERSION_OUTPUT MATCHES "go([0-9]+\\.[0-9]+\\.?[0-9]*)[a-zA-Z0-9]* ([^/]+)/(.*)") 19 | set(GO_VERSION ${CMAKE_MATCH_1}) 20 | set(GO_PLATFORM ${CMAKE_MATCH_2}) 21 | set(GO_ARCH ${CMAKE_MATCH_3}) 22 | elseif(GO_VERSION_OUTPUT MATCHES "go version devel .* ([^/]+)/(.*)$") 23 | set(GO_VERSION "99-devel") 24 | set(GO_PLATFORM ${CMAKE_MATCH_1}) 25 | set(GO_ARCH ${CMAKE_MATCH_2}) 26 | message("WARNING: Development version of Go being used, can't determine compatibility.") 27 | endif() 28 | endif() 29 | mark_as_advanced(GO_EXECUTABLE) 30 | 31 | include(FindPackageHandleStandardArgs) 32 | find_package_handle_standard_args(Go REQUIRED_VARS GO_EXECUTABLE GO_VERSION GO_PLATFORM GO_ARCH VERSION_VAR GO_VERSION) 33 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/json_payload_transform.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | require "string" 6 | require "cjson" 7 | 8 | -- sample input {"name":"android_app_created","created_at":"2013-11-15 22:37:34.709739275"} 9 | 10 | local date_pattern = '^(%d+-%d+-%d+) (%d+:%d+:%d+%.%d+)' 11 | function process_message () 12 | local ok, json = pcall(cjson.decode, read_message("Payload")) 13 | if not ok then 14 | return -1 15 | end 16 | local d, t = string.match(json.created_at, date_pattern) 17 | if d then 18 | json.created_at = string.format("%sT%sZ", d, t) 19 | inject_payload("json", "transformed timestamp", cjson.encode(json)) 20 | end 21 | return 0 22 | end 23 | 24 | -- sample output 25 | --2013/11/15 15:25:56 < 26 | -- Timestamp: 2013-11-15 15:25:56.826184879 -0800 PST 27 | -- Type: logfile 28 | -- Hostname: trink-x230 29 | -- Pid: 0 30 | -- UUID: ef5de908-822a-4fe1-a564-ad3b5a9631c6 31 | -- Logger: test.log 32 | -- Payload: {"name":"android_app_created","created_at":"2013-11-15T22:37:34.709739275Z"} 33 | -- 34 | -- EnvVersion: 0.8 35 | -- Severity: 0 36 | -- Fields: [name:"payload_type" value_type:STRING representation:"file-extension" value_string:"json" name:"payload_name" value_type:STRING representation:"" value_string:"transformed timestamp" ] 37 | 38 | -------------------------------------------------------------------------------- /dasher/javascript/adapters/termination_report_adapter.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "underscore", 4 | "jquery", 5 | "backbone", 6 | "adapters/base_adapter", 7 | "lib/termination_report" 8 | ], 9 | function(_, $, Backbone, BaseAdapter, TerminationReport) { 10 | "use strict"; 11 | 12 | /** 13 | * Adapter for retrieving the sandbox termination report. 14 | * 15 | * Consumes `/data/heka_sandbox_termination.tsv`. 16 | * 17 | * @class TerminationReportAdapter 18 | * @extends BaseAdapter 19 | * 20 | * @constructor 21 | */ 22 | var TerminationReportAdapter = function() { 23 | /** 24 | * Termination report collection to be filled by the adapter. 25 | * 26 | * @property {Backbone.Collection} terminationReportCollection 27 | */ 28 | this.terminationReportCollection = new Backbone.Collection(); 29 | }; 30 | 31 | _.extend(TerminationReportAdapter.prototype, new BaseAdapter(), { 32 | /** 33 | * Fills terminationReportCollection with data fetched from the server. 34 | * 35 | * @method fill 36 | */ 37 | fill: function() { 38 | this.fetch("data/heka_sandbox_termination.tsv", function(response) { 39 | var terminationReport = TerminationReport.parse(response); 40 | 41 | this.terminationReportCollection.set(terminationReport.data); 42 | }.bind(this)); 43 | 44 | this.pollForUpdates(5000); 45 | } 46 | }); 47 | 48 | return TerminationReportAdapter; 49 | } 50 | ); 51 | -------------------------------------------------------------------------------- /dasher/javascript/templates/health/plugins_show.mustache: -------------------------------------------------------------------------------- 1 |

{{Name}}

2 | 3 |
4 |
5 |

Properties

6 | 7 | {{#hasKeysAndValues}} 8 | 9 | 10 | 11 | 12 | 13 | 14 | {{#keysAndValues}} 15 | 16 | 17 | 18 | 19 | {{/keysAndValues}} 20 | 21 |
NameValue
{{key}}{{value}}
22 | {{/hasKeysAndValues}} 23 | 24 | {{^hasKeysAndValues}} 25 |
No additional properties
26 | {{/hasKeysAndValues}} 27 |
28 | 29 | {{#hasOutputs}} 30 |
31 |

Plug-in Outputs

32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | {{#Outputs}} 40 | 41 | 42 | 43 | 44 | {{/Outputs}} 45 | 46 |
NameType
{{Name}}{{^Name}}[Untitled]{{/Name}}{{Type}}
47 |
48 | {{/hasOutputs}} 49 |
50 | -------------------------------------------------------------------------------- /docs/source/sandbox/index.rst: -------------------------------------------------------------------------------- 1 | .. _sandbox: 2 | 3 | ======= 4 | Sandbox 5 | ======= 6 | 7 | Sandboxes are Heka plugins that are implemented in a sandboxed scripting 8 | language. They provide a dynamic and isolated execution environment 9 | for data parsing, transformation, and analysis. They allow real time access to 10 | data in production without jeopardizing the integrity or performance of the 11 | monitoring infrastructure and do not require Heka to be recompiled. 12 | This broadens the audience that the data can be exposed to and facilitates new 13 | uses of the data (i.e. debugging, monitoring, dynamic provisioning, SLA 14 | analysis, intrusion detection, ad-hoc reporting, etc.) 15 | 16 | Features 17 | ======== 18 | 19 | - dynamic loading 20 | - SandboxFilters can be started/stopped on a self-service basis while Heka is running 21 | - SandboxDecoder can only be started/stopped on a Heka restart but no recompilation is required to add new functionality. 22 | - small - memory requirements are about 16 KiB for a basic sandbox 23 | - fast - microsecond execution times 24 | - stateful - ability to resume where it left off after a restart/reboot 25 | - isolated - failures are contained and malfunctioning sandboxes are terminated 26 | 27 | .. include:: lua.rst 28 | .. include:: input.rst 29 | .. include:: decoder.rst 30 | .. include:: filter.rst 31 | .. include:: encoder.rst 32 | .. include:: output.rst 33 | .. include:: module.rst 34 | .. include:: lpeg.rst 35 | .. include:: manager.rst 36 | .. include:: development.rst 37 | .. include:: cookbook.rst 38 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/annotation.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | local annotation = require "annotation" 6 | 7 | function process_message () 8 | local test = read_message("Timestamp") 9 | 10 | if test == 0 then 11 | local current_ns = 60*1e9 12 | annotation.add("test", 1e9, 1, "A", "anomaly") 13 | annotation.add("test", 5e9, 2, "A", "anomaly2") 14 | annotation.add("test", current_ns, 1, "M", "maintenance") 15 | inject_payload("json", "annotations", annotation.prune("test", current_ns)) 16 | elseif test == 1 then 17 | annotation.set_prune("test", 30*1e9) 18 | inject_payload("json", "annotations", annotation.prune("test", 80*1e9)) 19 | elseif test == 2 then 20 | inject_payload("json", "annotations", annotation.prune("test", 90*1e9)) 21 | elseif test == 3 then 22 | local annos = {} 23 | table.insert(annos, annotation.create(5*1e9, 2, "A", "anomaly3")) 24 | table.insert(annos, annotation.create(90*1e9, 2, "A", "anomaly4")) 25 | annotation.concat("test", annos) 26 | assert(#_ANNOTATIONS.test.annotations == 2, #_ANNOTATIONS.test.annotations) 27 | local a = annotation.prune("test", 90*1e9) 28 | assert(#_ANNOTATIONS.test.annotations == 1, #_ANNOTATIONS.test.annotations) 29 | inject_payload("txt", "", "ok") 30 | end 31 | return 0 32 | end 33 | -------------------------------------------------------------------------------- /logstreamer/testdir/filehandling/2010/07/error.log: -------------------------------------------------------------------------------- 1 | 2013-11-05 19:50:24.544422 PST - Registered node with name '/Search' 2 | 2013-11-05 19:50:24.546481 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/legacy.bundle' 3 | 2013-11-05 19:50:24.548489 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/search.bundle' 4 | 2013-11-05 19:50:25.621457 PST - '/Search' has registered, loading additional services 5 | 2013-11-05 19:50:25.621468 PST - Initialize augmentation support 6 | 2013-11-05 19:50:25.625466 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/SystemCache.bundle' 7 | 2013-11-05 19:50:25.635568 PST - Successfully registered for Kernel identity service requests 8 | 2013-11-05 19:50:25.635585 PST - Adjusting kernel ID cache (100 -> 250) and membership cache (100 -> 500) 9 | 2013-11-05 19:50:25.649614 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/PlistFile.bundle' 10 | 2013-11-05 19:50:25.651720 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/FDESupport.bundle' 11 | 2013-11-05 19:50:25.654747 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/AppleID.bundle' 12 | 2013-11-05 19:50:25.684944 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/ConfigurationProfiles.bundle' 13 | 2013-11-05 19:50:25.686039 PST - Registered subnode with name '/Local/Default' 14 | 2013-11-05 19:50:29.805471 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/ldap.bundle' 15 | 2013-11-05 19:51:34.948075 PST - Loaded bundle at path '/System/Library/OpenDirectory/Modules/configure.bundle' 16 | -------------------------------------------------------------------------------- /dasher/javascript/adapters/sandbox_output_txt_adapter.js: -------------------------------------------------------------------------------- 1 | define( 2 | [ 3 | "underscore", 4 | "adapters/base_adapter" 5 | ], 6 | function(_, BaseAdapter) { 7 | "use strict"; 8 | 9 | /** 10 | * Adapter for retrieving plain text data from sandbox outputs. 11 | * 12 | * Consumes `/data/*.txt`. 13 | * 14 | * Note: This is the fallback sandbox output adapter so it can fetch any type of document that 15 | * isn't a circular buffer. 16 | * 17 | * @class SandboxOutputTxtAdapter 18 | * @extends BaseAdapter 19 | * 20 | * @constructor 21 | * 22 | * @param {SandboxOutput} sandboxOutput SandboxOutput to be filled by the adapter 23 | */ 24 | var SandboxOutputTxtAdapter = function(sandboxOutput) { 25 | /** 26 | * SandboxOutput to be filled by the adapter. 27 | * 28 | * @property {SandboxOutput} sandboxOutput 29 | */ 30 | this.sandboxOutput = sandboxOutput; 31 | }; 32 | 33 | _.extend(SandboxOutputTxtAdapter.prototype, new BaseAdapter(), { 34 | /** 35 | * Fills sandboxOutput with data fetched from the server. Sets the data attribute on 36 | * sandboxOutput. Polls the server for updates after fetching data. 37 | * 38 | * @method fill 39 | */ 40 | fill: function() { 41 | this.fetch(this.sandboxOutput.get("Filename"), function(response) { 42 | this.sandboxOutput.set("data", response); 43 | 44 | this.pollForUpdates(); 45 | }.bind(this)); 46 | } 47 | }); 48 | 49 | return SandboxOutputTxtAdapter; 50 | } 51 | ); 52 | -------------------------------------------------------------------------------- /client/senders.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # Mike Trinkala (trink@mozilla.com) 13 | # 14 | # ***** END LICENSE BLOCK *****/ 15 | 16 | package client 17 | 18 | import ( 19 | "crypto/tls" 20 | "net" 21 | ) 22 | 23 | type Sender interface { 24 | SendMessage(outBytes []byte) (err error) 25 | Close() 26 | } 27 | 28 | type NetworkSender struct { 29 | connection net.Conn 30 | } 31 | 32 | func NewNetworkSender(proto, addr string) (*NetworkSender, error) { 33 | var sender *NetworkSender 34 | conn, err := net.Dial(proto, addr) 35 | if err == nil { 36 | sender = &(NetworkSender{conn}) 37 | } 38 | return sender, err 39 | } 40 | 41 | func NewTlsSender(proto, addr string, config *tls.Config) (*NetworkSender, error) { 42 | var sender *NetworkSender 43 | conn, err := tls.Dial(proto, addr, config) 44 | if err == nil { 45 | sender = &(NetworkSender{conn}) 46 | } 47 | return sender, err 48 | } 49 | 50 | func (self *NetworkSender) SendMessage(outBytes []byte) (err error) { 51 | _, err = self.connection.Write(outBytes) 52 | return 53 | } 54 | 55 | func (self *NetworkSender) Close() { 56 | self.connection.Close() 57 | } 58 | -------------------------------------------------------------------------------- /docs/source/config/filters/index_noref.rst: -------------------------------------------------------------------------------- 1 | 2 | ======= 3 | Filters 4 | ======= 5 | 6 | .. include:: /config/filters/index.rst 7 | :start-after: _config_common_filter_parameters: 8 | :end-before: Available Filter Plugins 9 | 10 | .. include:: /config/filters/cbuf_delta.rst 11 | :start-line: 1 12 | 13 | .. include:: /config/filters/cbuf_delta_by_host.rst 14 | :start-line: 1 15 | 16 | .. include:: /config/filters/counter.rst 17 | :start-line: 1 18 | 19 | .. include:: /config/filters/cpu_stats.rst 20 | :start-line: 1 21 | 22 | .. include:: /config/filters/disk_stats.rst 23 | :start-line: 1 24 | 25 | .. include:: /config/filters/frequent_items.rst 26 | :start-line: 1 27 | 28 | .. include:: /config/filters/heka_memstat.rst 29 | :start-line: 1 30 | 31 | .. include:: /config/filters/message_schema.rst 32 | :start-line: 1 33 | 34 | .. include:: /config/filters/http_status.rst 35 | :start-line: 1 36 | 37 | .. include:: /config/filters/influx_batch.rst 38 | :start-line: 1 39 | 40 | .. include:: /config/filters/load_avg.rst 41 | :start-line: 1 42 | 43 | .. include:: /config/filters/mem_stats.rst 44 | :start-line: 1 45 | 46 | .. include:: /config/filters/mysql_slow_query.rst 47 | :start-line: 1 48 | 49 | .. include:: /config/filters/sandbox.rst 50 | :start-line: 1 51 | 52 | .. include:: /config/filters/sandboxmanager.rst 53 | :start-line: 1 54 | 55 | .. include:: /config/filters/stat.rst 56 | :start-line: 1 57 | 58 | .. include:: /config/filters/stats_graph.rst 59 | :start-line: 1 60 | 61 | .. include:: /config/filters/unique_items.rst 62 | :start-line: 1 63 | -------------------------------------------------------------------------------- /sandbox/lua/testsupport/graphite.lua: -------------------------------------------------------------------------------- 1 | require "string" 2 | require "math" 3 | require "table" 4 | require "cjson" 5 | 6 | local graphite = require "graphite" 7 | 8 | local status_codes = {} 9 | local request_times = {} 10 | 11 | local ticker_interval = 10 12 | local percent_thresh = 90 13 | 14 | function process_message() 15 | local hostname = read_message("Hostname") 16 | local logger = read_message("Logger") 17 | local status = read_message("Fields[status]") 18 | local request_time = read_message("Fields[request_time]") 19 | 20 | local bucket = string.format("%s.nginx.%s.http_%d", hostname, logger, status) 21 | local val = status_codes[bucket] or 0 22 | status_codes[bucket] = val + 1 23 | 24 | bucket = string.format("%s.nginx.%s.request_time", hostname, logger) 25 | val = request_times[bucket] or {} 26 | val[#val+1] = request_time 27 | request_times[bucket] = val 28 | return 0 29 | end 30 | 31 | function timer_event(ns) 32 | local now_sec = graphite.ns_to_sec(ns) 33 | local num_stats = 0 34 | 35 | for bucket, count in pairs(status_codes) do 36 | num_stats = num_stats + 1 37 | end 38 | 39 | add_to_payload(graphite.multi_counts_rates(status_codes, ticker_interval, now_sec)) 40 | add_to_payload(graphite.multi_timeseries_metrics(request_times, ticker_interval, percent_thresh, now_sec)) 41 | 42 | for bucket, times in pairs(request_times) do 43 | num_stats = num_stats + 1 44 | end 45 | 46 | add_to_payload(string.format("stats.statsd.numStats %d %d\n", num_stats, now_sec)) 47 | inject_payload("txt", "statmetric") 48 | end 49 | -------------------------------------------------------------------------------- /docs/source/config/encoders/payload.rst: -------------------------------------------------------------------------------- 1 | .. _config_payloadencoder: 2 | 3 | Payload Encoder 4 | =============== 5 | 6 | Plugin Name: **PayloadEncoder** 7 | 8 | The PayloadEncoder simply extracts the payload from the provided Heka message 9 | and converts it into a byte stream for delivery to an external resource. 10 | 11 | .. _payloadencoder_settings: 12 | 13 | Config: 14 | 15 | - append_newlines (bool, optional): 16 | Specifies whether or not a newline character (i.e. `\n`) will be appended 17 | to the captured message payload before serialization. Defaults to true. 18 | 19 | - prefix_ts (bool, optional): 20 | Specifies whether a timestamp will be prepended to the captured message 21 | payload before serialization. Defaults to false. 22 | 23 | - ts_from_message (bool, optional): 24 | If true, the prepended timestamp will be extracted from the message that 25 | is being processed. If false, the prepended timestamp will be generated by 26 | the system clock at the time of message processing. Defaults to true. This 27 | setting has no impact if `prefix_ts` is set to false. 28 | 29 | - ts_format (string, optional): Specifies the format that should be used for 30 | prepended timestamps, using the standard `strftime string format 31 | `_. Defaults to ``[%Y/%b/%d:%H:%M:%S %z]``. If the 32 | specified format string does not end with a space character, then a space 33 | will be inserted between the formatted timestamp and the payload. 34 | 35 | Example 36 | 37 | .. code-block:: ini 38 | 39 | [PayloadEncoder] 40 | append_newlines = false 41 | prefix_ts = true 42 | ts_format = "%Y/%m/%d %l:%M:%S%p %Z" 43 | -------------------------------------------------------------------------------- /sandbox/plugins/all_specs_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012-2014 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Mike Trinkala (trink@mozilla.com) 12 | # Rob Miller (rmiller@mozilla.com) 13 | # 14 | # ***** END LICENSE BLOCK *****/ 15 | 16 | package plugins 17 | 18 | import ( 19 | "os" 20 | "testing" 21 | "time" 22 | 23 | "github.com/mozilla-services/heka/message" 24 | "github.com/pborman/uuid" 25 | gs "github.com/rafrombrc/gospec/src/gospec" 26 | ) 27 | 28 | func TestAllSpecs(t *testing.T) { 29 | r := gs.NewRunner() 30 | r.Parallel = false 31 | 32 | r.AddSpec(InputSpec) 33 | r.AddSpec(FilterSpec) 34 | r.AddSpec(DecoderSpec) 35 | r.AddSpec(EncoderSpec) 36 | r.AddSpec(OutputSpec) 37 | 38 | gs.MainGoTest(r, t) 39 | } 40 | 41 | func getTestMessage() *message.Message { 42 | hostname := "my.host.name" 43 | field, _ := message.NewField("foo", "bar", "") 44 | msg := &message.Message{} 45 | msg.SetType("TEST") 46 | msg.SetTimestamp(time.Now().UnixNano()) 47 | msg.SetUuid(uuid.NewRandom()) 48 | msg.SetLogger("GoSpec") 49 | msg.SetSeverity(int32(6)) 50 | msg.SetPayload("Test Payload") 51 | msg.SetEnvVersion("0.8") 52 | msg.SetPid(int32(os.Getpid())) 53 | msg.SetHostname(hostname) 54 | msg.AddField(field) 55 | return msg 56 | } 57 | -------------------------------------------------------------------------------- /sandbox/lua/encoders/alert.lua: -------------------------------------------------------------------------------- 1 | -- This Source Code Form is subject to the terms of the Mozilla Public 2 | -- License, v. 2.0. If a copy of the MPL was not distributed with this 3 | -- file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 | 5 | --[[ 6 | Produces more human readable alert messages. 7 | 8 | Config: 9 | 10 | 11 | 12 | *Example Heka Configuration* 13 | 14 | .. code-block:: ini 15 | 16 | [FxaAlert] 17 | type = "SmtpOutput" 18 | message_matcher = "Type == 'heka.sandbox-output' && Fields[payload_type] == 'alert' && Logger =~ /^Fxa/" || Type == 'heka.sandbox-terminated' && Fields[plugin] =~ /^Fxa/" 19 | send_from = "heka@example.com" 20 | send_to = ["alert@example.com"] 21 | auth = "Plain" 22 | user = "test" 23 | password = "testpw" 24 | host = "localhost:25" 25 | encoder = "AlertEncoder" 26 | 27 | [AlertEncoder] 28 | type = "SandboxEncoder" 29 | filename = "lua_encoders/alert.lua" 30 | 31 | *Example Output* 32 | 33 | :Timestamp: 2014-05-14T14:20:18Z 34 | :Hostname: ip-10-226-204-51 35 | :Plugin: FxaBrowserIdHTTPStatus 36 | :Alert: HTTP Status - algorithm: roc col: 1 msg: detected anomaly, standard deviation exceeds 1.5 37 | --]] 38 | 39 | require "os" 40 | require "string" 41 | 42 | function process_message () 43 | local ts = os.date("%FT%TZ", read_message("Timestamp") / 1e9) 44 | local hn = read_message("Hostname") 45 | local pi = read_message("Logger") 46 | local pl = read_message("Payload") 47 | 48 | inject_payload("txt", "", 49 | string.format("Timestamp: %s\nHostname: %s\nPlugin: %s\nAlert: %s\n", ts, hn, pi, pl)) 50 | return 0 51 | end 52 | 53 | -------------------------------------------------------------------------------- /dasher/javascript/templates/sandboxes/sandbox_output_cbuf_show.mustache: -------------------------------------------------------------------------------- 1 |

{{SandboxName}}

2 |
3 |
4 |

{{Name}}{{^Name}}Untitled output{{/Name}} {{#hasHeader}}{{aggregationDescription}}{{/hasHeader}}

5 |
6 |
7 |
8 | Embed 9 | Raw 10 |
11 |
12 |
13 |
14 |
15 |
16 | Click and drag to zoom | 17 | Shift-drag to pan | 18 | Double-click to zoom out 19 |
20 |
21 | 22 |
23 |
24 |
25 |
26 | {{#legendLabels}} 27 | 28 | {{/legendLabels}} 29 |
30 |
31 | -------------------------------------------------------------------------------- /pipeline/all_specs_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2012 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # Mike Trinkala (trink@mozilla.com) 13 | # 14 | # ***** END LICENSE BLOCK *****/ 15 | 16 | package pipeline 17 | 18 | import ( 19 | "testing" 20 | 21 | "github.com/rafrombrc/gospec/src/gospec" 22 | ) 23 | 24 | func mockDecoderCreator() map[string]Decoder { 25 | return make(map[string]Decoder) 26 | } 27 | 28 | func mockFilterCreator() map[string]Filter { 29 | return make(map[string]Filter) 30 | } 31 | 32 | func mockOutputCreator() map[string]Output { 33 | return make(map[string]Output) 34 | } 35 | 36 | func TestAllSpecs(t *testing.T) { 37 | r := gospec.NewRunner() 38 | r.Parallel = false 39 | 40 | r.AddSpec(HekaFramingSpec) 41 | r.AddSpec(InputRunnerSpec) 42 | r.AddSpec(MessageTemplateSpec) 43 | r.AddSpec(OutputRunnerSpec) 44 | r.AddSpec(ProtobufDecoderSpec) 45 | r.AddSpec(QueueBufferSpec) 46 | r.AddSpec(RegexSpec) 47 | r.AddSpec(ReportSpec) 48 | r.AddSpec(SplitterRunnerSpec) 49 | r.AddSpec(StatAccumInputSpec) 50 | r.AddSpec(TokenSpec) 51 | 52 | gospec.MainGoTest(r, t) 53 | } 54 | 55 | func BenchmarkPipelinePackCreation(b *testing.B) { 56 | var config = PipelineConfig{} 57 | for i := 0; i < b.N; i++ { 58 | NewPipelinePack(config.inputRecycleChan) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /plugins/scribble_decoder_test.go: -------------------------------------------------------------------------------- 1 | /***** BEGIN LICENSE BLOCK ***** 2 | # This Source Code Form is subject to the terms of the Mozilla Public 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 | # You can obtain one at http://mozilla.org/MPL/2.0/. 5 | # 6 | # The Initial Developer of the Original Code is the Mozilla Foundation. 7 | # Portions created by the Initial Developer are Copyright (C) 2014 8 | # the Initial Developer. All Rights Reserved. 9 | # 10 | # Contributor(s): 11 | # Rob Miller (rmiller@mozilla.com) 12 | # 13 | # ***** END LICENSE BLOCK *****/ 14 | 15 | package plugins 16 | 17 | import ( 18 | . "github.com/mozilla-services/heka/pipeline" 19 | pipeline_ts "github.com/mozilla-services/heka/pipeline/testsupport" 20 | "github.com/rafrombrc/gomock/gomock" 21 | gs "github.com/rafrombrc/gospec/src/gospec" 22 | ) 23 | 24 | func ScribbleDecoderSpec(c gs.Context) { 25 | t := &pipeline_ts.SimpleT{} 26 | ctrl := gomock.NewController(t) 27 | defer ctrl.Finish() 28 | 29 | c.Specify("A ScribbleDecoder", func() { 30 | decoder := new(ScribbleDecoder) 31 | config := decoder.ConfigStruct().(*ScribbleDecoderConfig) 32 | myType := "myType" 33 | myPayload := "myPayload" 34 | config.MessageFields = MessageTemplate{"Type": myType, "Payload": myPayload} 35 | supply := make(chan *PipelinePack, 1) 36 | pack := NewPipelinePack(supply) 37 | 38 | c.Specify("sets basic values correctly", func() { 39 | decoder.Init(config) 40 | packs, err := decoder.Decode(pack) 41 | c.Expect(err, gs.IsNil) 42 | c.Expect(len(packs), gs.Equals, 1) 43 | c.Expect(pack.Message.GetType(), gs.Equals, myType) 44 | c.Expect(pack.Message.GetPayload(), gs.Equals, myPayload) 45 | }) 46 | }) 47 | } 48 | --------------------------------------------------------------------------------