{"revision": {"id": "f3e2157a-2f95-11f1-bcde-e86a64d24d78", "node_id": "f3e12ab2-2f95-11f1-9e11-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Hacking on heka log router\r\n############################\r\n\r\ndownload and install go\r\n\r\n.. code-block:: bash\r\n\r\n wget http://go.googlecode.com/files/go1.2.1.linux-amd64.tar.gz\r\n\r\n sudo tar -C /usr/local -xzf go1.2.1.linux-amd64.tar.gz\r\n\r\n # this is a hack, use soft links or install in the proper location the first time\r\n sudo mv /usr/local/go/* /usr/bin\r\n\r\n\r\n\r\n\r\nBuild heka\r\n==============\r\n\r\n.. code-block:: bash\r\n\r\n source build.sh\r\n\r\n\r\nTest heka\r\n=====================\r\n\r\nSo 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`_.\r\n\r\nIf that works, make heka/build your current working directory and run either:\r\n\r\n.. code-block:: bash\r\n\r\n make test\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n ctest\r\n\r\nto test only the code you are changing run:h\r\n\r\n.. code-block:: bash\r\n\r\n # ctest -R [desired-test]\r\n ctest -R tcp\r\n\r\n\r\n\r\n\r\nhow I resolved regexp default delimiter defect\r\n======================================================\r\n\r\nThis patch resolves a defect that causes the regexp default\r\nconfig delimiter to always be clobbered, now we check before we step.\r\n\r\n\t`modified:   plugins/tcp/tcp_input.go`\r\n\r\n\r\nHere is the manual test case:\r\n\r\n.. code-block:: toml\r\n\r\n    [TcpInput]\r\n    address = \"127.0.0.1:5565\"\r\n    parser_type = \"regexp\"\r\n\r\n    [STDOUT]\r\n    type = \"LogOutput\"\r\n    message_matcher = \"TRUE\"\r\n    payload_only = true\r\n\r\nand I used netcat to test:\r\n\r\n\r\n.. code-block:: bash\r\n\r\n    nc 127.0.0.1 5565\r\n    hello, heka!\r\n\r\nI tried to run the unit tests in the code base with `go test` but I got errors about missing libraries ...\r\n\r\nOk, I learned from reviewing TravisCI output that I needed `sudo apt-get install protobuf-compiler` in order to run `go test`. \r\n\r\n\r\nheka and ssl\r\n==================\r\n\r\nheka supports SSL, for testing I used self signed certs, it looked something like this:\r\n\r\nedit openssl.conf and add the following entry to the **[ v3_ca ]** substituting the IP address as needed:\r\n\r\n\r\n\r\n.. code-block:: bash\r\n\r\n sudo vim /etc/ssl/openssl.cnf\r\n\r\n.. code-block:: bash\r\n\r\n subjectAltName = IP:192.168.1.62\r\n\r\nProduce self-signed crt and key:\r\n\r\n.. code-block:: bash\r\n\r\n sudo openssl req -x509 -batch -nodes -newkey rsa:2048 -keyout self-signed.key -out self-signed.crt\r\n\r\nOn the outbound TCP hekad \"client\" configuration I added the following:\r\n\r\n.. code-block:: bash\r\n\r\n use_tls = true\r\n\r\n     [tcp:9612.tls]\r\n     insecure_skip_verify = true\r\n\r\nOn the inbound TCP hekad \"server\" configuration I added the following:\r\n\r\n.. code-block:: bash\r\n\r\n use_tls = true\r\n\r\n     [tcp:9612.tls]\r\n     cert_file = \"self-signed.crt\"\r\n     key_file = \"self-signed.key\"\r\n\r\nNotice 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. \r\n \r\n", "source_format": "rst", "revision_number": 12, "created": 1409094970000}}