diff options
| -rw-r--r-- | .gitignore | 4 | ||||
| l--------- | README | 1 | ||||
| -rw-r--r-- | README.adoc | 151 | ||||
| -rw-r--r-- | README.md | 74 |
4 files changed, 154 insertions, 76 deletions
@@ -1,3 +1,3 @@ -/haminer +*.html /cover.out -/cover.html +/haminer @@ -0,0 +1 @@ +README.adoc
\ No newline at end of file diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..644117a --- /dev/null +++ b/README.adoc @@ -0,0 +1,151 @@ += haminer +:toc: +:sectanchors: +:sectlinks: + +Library and program to parse and forward HAProxy logs. + +Supported forwarder, + +* Influxdb + + +== Requirements + +* https://golang.org[Go^] for building from source code +* https://git-scm.com/[git^] for downloading source code + +One of supported time series database for storing HAProxy log, either + +* https://portal.influxdata.com/downloads[InfluxDB^] +* https://questdb.io[QuestDB^] + + +== Building + +This steps assume that you already installed `Go` and `git`. + +Get the source code using git, + +---- +$ git clone https://git.sr.ht/~shulhan/haminer +$ cd haminer +$ make +---- + +The binary name is `haminer` build in the current directory. + + +== Configuration + +haminer by default will load it's config from `/etc/haminer.conf`, if not +specified when running the program. + +See +https://git.sr.ht/~shulhan/haminer/tree/main/item/cmd/haminer/haminer.conf[haminer.conf^] +for an example of possible configuration and their explanation. + + +=== Forwarders + +Currently, there are two supported database where haminer can forward the +parsed log: influxdb and questdb. +Haminer support Influxdb v1 and v2. + +==== Influxdb v1 + +For v1, you need to create the user and database first, + +---- +$ influx +> CREATE USER "haminer" WITH PASSWORD 'haminer' +> CREATE DATABASE haminer +> GRANT ALL ON haminer TO haminer +---- + +Example of forwarder configuration, + +---- +[forwarder "influxd"] +version = v1 +url = http://127.0.0.1:8086 +bucket = haminer +user = haminer +password = haminer +---- + +==== Influxdb v2 + +For v2, + +---- +$ sudo influx bucket create \ + --name haminer \ + --retention 30d +---- + +For v2, the example configuration is + +---- +[forwarder "influxd"] +version = v1 +url = http://127.0.0.1:8086 +org = $org +bucket = haminer +token = $token +---- + +==== Questdb + +For questdb the configuration is quite simple, + +---- +[forwarder "questdb"] +url = udp://127.0.0.1:9009 +---- + +We did not need to create the table, questdb will handled that automatically. + + +== Installation + +. Copy configuration from `$SOURCE/cmd/haminer/haminer/conf` to +`/etc/haminer.conf` + +. Update haminer configuration in `/etc/haminer.conf` ++ +-- +For example, +---- +[haminer] +listen = 127.0.0.1:5140 + +... +---- + +Add one or more provider to the configuration as the example above. +-- + +. Update HAProxy config to forward log to UDP port other than rsyslog. ++ +-- +For example, +---- +global + ... + log 127.0.0.1:5140 local3 + ... +---- +Then reload or restart HAProxy. +-- + +. Run the haminer program, ++ +-- +---- +$ haminer +---- +or use a +https://git.sr.ht/~shulhan/haminer/tree/main/item/cmd/haminer/haminer.service[systemd +service^]. +-- diff --git a/README.md b/README.md deleted file mode 100644 index bb90a3d..0000000 --- a/README.md +++ /dev/null @@ -1,74 +0,0 @@ -# haminer - -Library and program to parse and forward HAProxy logs. - -Supported forwarder, - -* Influxdb - - -## Requirements - -* [Go](https://golang.org) for building from source code -* [git](https://git-scm.com/) for downloading source code -* [InfluxDB](https://portal.influxdata.com/downloads) for storing - HAProxy log. -* [Chronograf](https://portal.influxdata.com/downloads) for viewing - influxdb data with graph. - - -## Building - -This steps assume that you already installed `Go`, `git`, and `influxdb`. - -Get the source code using git, - - $ git clone https://git.sr.ht/~shulhan/haminer - $ cd haminer - $ make - -The binary will be installed on `$GOPATH/bin/haminer`. - - -## Configuration - -haminer by default will load it's config from `/etc/haminer.conf`, if not -specified when running the program. - -See -[haminer.conf](https://git.sr.ht/~shulhan/haminer/tree/main/item/cmd/haminer/haminer.conf) -for an example of possible configuration and their explanation. - - -## Installation - -(1) Copy configuration from `$SOURCE/cmd/haminer/haminer/conf` to -`/etc/haminer.conf` - -(2) Update haminer configuration in `/etc/haminer.conf` - -(3) Update HAProxy config to forward log to UDP port other than rsyslog, for -example, - -``` -global - ... - log 127.0.0.1:5140 local3 - ... -``` - -Then reload or restart HAProxy. - -(4) Create user and database in Influxdb, - - $ influx - > CREATE USER "haminer" WITH PASSWORD 'haminer' - > CREATE DATABASE haminer - > GRANT ALL ON haminer TO haminer - -(5) Run the haminer program manually, - - $ $GOPATH/bin/haminer - -or use a -[systemd service](https://git.sr.ht/~shulhan/haminer/tree/main/item/cmd/haminer/haminer.service). |
