Welcome to Statsdbeat.
Ensure that this folder is at the following location:
${GOPATH}/src/github.com/sentient/statsdbeat
- Golang > 1.17
To get running with Statsdbeat and also install the dependencies, run the following command:
It will create a clean git history for each major step. Note that you can always rewrite the history if you wish before pushing your changes.
To push Statsdbeat in the git repository, run the following commands:
git remote set-url origin https://github.com/sentient/statsdbeat
For further development, check out the beat developer guide.
To build the binary for Statsdbeat run the command below. This will generate a binary in the same directory with the name statsdbeat.
mage build
./statsdbeat -c statsdbeat.yml
Log output to console. Run Statsdbeat with debugging output enabled:
./statsdbeat -c statsdbeat.yml -e -d "statsdbeat"
or everything in debug
./statsdbeat -c statsdbeat.yml -e -d "*"
To test Statsdbeat, run the following command:
mage test
>> go test: Unit Testing
exec: gotestsum --no-color -f standard-quiet --junitfile build/TEST-go-unit.xml --jsonfile build/TEST-go-unit.out.json -- ./...
ok github.com/sentient/statsdbeat/config 0.004s [no tests to run]
ok github.com/sentient/statsdbeat/beater 0.021s
ok github.com/sentient/statsdbeat 0.045s
? github.com/sentient/statsdbeat/cmd [no test files]
? github.com/sentient/statsdbeat/include [no test files]
Send testdata with
echo -n "accounts.authentication.password.failed:1|c" | nc -u -w0 127.0.0.1 8125
echo -n "accounts.authentication.login.time:320|ms" | nc -u -w0 127.0.0.1 8125
echo -n "accounts.authentication.login.num_users:333|g" | nc -u -w0 127.0.0.1 8125
echo -en "n.s.t.cnt1:1|c\n.s.t.nct2:2|c" | nc -u -w0 127.0.0.1 8125
alternatively:
go test ./... -v
The test coverage is reported in the folder ./build/coverage/
Each beat has a template for the mapping in elasticsearch and a documentation for the fields
which is automatically generated based on fields.yml
by running the following command.
mage update
To clean Statsdbeat source code, run the following commands:
mage clean
To clean up the build directory and generated artifacts, run:
make clean
To clone Statsdbeat from the git repository, run the following commands:
mkdir -p ${GOPATH}/src/github.com/sentient/statsdbeat
git clone https://github.com/sentient/statsdbeat ${GOPATH}/src/github.com/sentient/statsdbeat
For further development, check out the beat developer guide.
./statsdbeat test output
elasticsearch: http://localhost:9200...
parse url... OK
connection...
parse host... OK
dns lookup... OK
addresses: ::1, 127.0.0.1
dial up... OK
TLS... WARN secure connection disabled
talk to server... OK
version: 7.14.2
./statsdbeat setup template
ILM policy and write alias loading not enabled.
Index setup finished.
mage
Targets:
build builds the Beat binary.
buildGoDaemon builds the go-daemon binary (use crossBuildGoDaemon).
check formats code, updates generated content, check for common errors, and checks for any modified files.
clean cleans all generated files and build artifacts.
config generates both the short/reference/docker configs.
crossBuild cross-builds the beat for all target platforms.
fields generates a fields.yml for the Beat.
fmt formats source code (.go and .py) and adds license headers.
golangCrossBuild build the Beat binary inside of the golang-builder.
package packages the Beat for distribution.
test runs all available tests
update updates the generated files (aka make update).
go get github.com/containerd/containerd@v1.5.9
go get github.com/opencontainers/image-spec@v1.0.2
The beat frameworks provides tools to crosscompile and package your beat for different platforms. This requires docker and vendoring as described above. To build packages of your beat, run the following command:
mage package
This will fetch and create all images required for the build process. The whole process to finish can take several minutes.
just build some...
PLATFORMS='linux/arm64' mage package
...
>> package: Building statsdbeat type=rpm for platform=linux/arm64
>> package: Building statsdbeat type=deb for platform=linux/arm64
>> package: Building statsdbeat type=tar.gz for platform=linux/arm64
...
output will be in 'build\distributions'