% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdftitle={building-heka},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{building-heka}
\author{}
\date{}

\begin{document}
\maketitle

\hypertarget{building-heka}{%
\section{building-heka}\label{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

\hypertarget{build-heka}{%
\section{Build heka}\label{build-heka}}

.. code-block:: bash

source build.sh

\hypertarget{test-heka}{%
\section{Test heka}\label{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 \texttt{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

\hypertarget{how-i-resolved-regexp-default-delimiter-defect}{%
\section{how I resolved regexp default delimiter
defect}\label{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.

\begin{verbatim}
`modified:   plugins/tcp/tcp_input.go`
\end{verbatim}

Here is the manual test case:

.. code-block:: toml

\begin{verbatim}
[TcpInput]
address = "127.0.0.1:5565"
parser_type = "regexp"

[STDOUT]
type = "LogOutput"
message_matcher = "TRUE"
payload_only = true
\end{verbatim}

and I used netcat to test:

.. code-block:: bash

\begin{verbatim}
nc 127.0.0.1 5565
hello, heka!
\end{verbatim}

I tried to run the unit tests in the code base with \texttt{go\ test}
but I got errors about missing libraries \ldots{}

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

\hypertarget{heka-and-ssl}{%
\section{heka and ssl}\label{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

\begin{verbatim}
 [tcp:9612.tls]
 insecure_skip_verify = true
\end{verbatim}

On the inbound TCP hekad ``server'' configuration I added the following:

.. code-block:: bash

use\_tls = true

\begin{verbatim}
 [tcp:9612.tls]
 cert_file = "/etc/ssl/certs/ssl-cert-snakeoil.pem"
 key_file = "/etc/ssl/private/ssl-cert-snakeoil.key"
\end{verbatim}

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.

\end{document}
