building-heka

building-heka

Hacking on heka log router ############################

download and install go

.. code-block:: bash

wget http://go.googlecode.com/files/go1.2.1.linux-amd64.tar.gz

sudo tar -C /usr/local -xzf go1.2.1.linux-amd64.tar.gz

# this is a hack, use soft links or install in the proper location the first time sudo mv /usr/local/go/* /usr/bin

Build heka

.. code-block:: bash

source build.sh

Test heka

So first you need to make sure you have all the dependencies needed to build heka, the best way to find out is to Build heka_.

If that works, make heka/build your current working directory and run either:

.. code-block:: bash

make test

or:

.. code-block:: bash

ctest

to test only the code you are changing run:h

.. code-block:: bash

# ctest -R [desired-test] ctest -R tcp

how I resolved regexp default delimiter defect

This patch resolves a defect that causes the regexp default config delimiter to always be clobbered, now we check before we step.

`modified:   plugins/tcp/tcp_input.go`

Here is the manual test case:

.. code-block:: toml

[TcpInput]
address = "127.0.0.1:5565"
parser_type = "regexp"

[STDOUT]
type = "LogOutput"
message_matcher = "TRUE"
payload_only = true

and I used netcat to test:

.. code-block:: bash

nc 127.0.0.1 5565
hello, heka!

I tried to run the unit tests in the code base with go test but I got errors about missing libraries …

Ok, I learned from reviewing TravisCI output that I needed sudo apt-get install protobuf-compiler in order to run go test.

heka and ssl

heka supports SSL, for testing I used self signed certs, it looked something like this:

On the outbound TCP hekad “client” configuration I added the following:

.. code-block:: bash

use_tls = true

 [tcp:9612.tls]
 insecure_skip_verify = true

On the inbound TCP hekad “server” configuration I added the following:

.. code-block:: bash

use_tls = true

 [tcp:9612.tls]
 cert_file = "/etc/ssl/certs/ssl-cert-snakeoil.pem"
 key_file = "/etc/ssl/private/ssl-cert-snakeoil.key"

Notice that we are skipping crt verification which is susceptible to man-in-the-middle-attacks. Also we are not using client verification. Heka supports both.