diff options
| author | Mark Felder <feld@FreeBSD.org> | 2026-01-01 00:38:40 +0000 |
|---|---|---|
| committer | Mark Felder <feld@FreeBSD.org> | 2026-01-01 01:27:31 +0000 |
| commit | 9702a3744ffa22cec0d647322d7c9b9a2395f8c0 (patch) | |
| tree | 6958b2a33e359da3dc647429f5606c5f811cf570 | |
| parent | 2a5aca791ab36604355e1a376c1d3379f76e0e90 (diff) | |
sysutils/mtail: New Port
mtail is a tool for extracting metrics from application logs to be
exported into a timeseries database or timeseries calculator for
alerting and dashboarding.
It fills a monitoring niche by being the glue between applications that
do not export their own internal state (other than via logs) and
existing monitoring systems, such that system operators do not need to
patch those applications to instrument them or writing custom extraction
code for every such application.
| -rw-r--r-- | GIDs | 2 | ||||
| -rw-r--r-- | UIDs | 2 | ||||
| -rw-r--r-- | sysutils/Makefile | 1 | ||||
| -rw-r--r-- | sysutils/mtail/Makefile | 44 | ||||
| -rw-r--r-- | sysutils/mtail/Makefile.gomod | 23 | ||||
| -rw-r--r-- | sysutils/mtail/distinfo | 47 | ||||
| -rw-r--r-- | sysutils/mtail/files/mtail.in | 30 | ||||
| -rw-r--r-- | sysutils/mtail/files/pkg-message.in | 31 | ||||
| -rw-r--r-- | sysutils/mtail/pkg-descr | 9 | ||||
| -rw-r--r-- | sysutils/mtail/pkg-plist | 34 |
10 files changed, 221 insertions, 2 deletions
@@ -325,7 +325,7 @@ hydroxide:*:381: _tlsrpt:*:382: cascade:*:383: omada:*:384: -# free: 385 +mtail:*:385: # free: 386 # free: 387 # free: 388 @@ -331,7 +331,7 @@ hydroxide:*:381:381::0:0:Hydroxide Daemon:/var/db/hydroxide:/usr/sbin/nologin _tlsrpt:*:382:382::0:0:TLSRPT Daemon:/nonexistent:/usr/sbin/nologin cascade:*:383:383::0:0:Cascade Daemon:/var/db/cascade:/usr/sbin/nologin omada:*:384:384::0:0:Omada Wireless Controller:/nonexistent:/usr/sbin/nologin -# free: 385 +mtail:*:385:385::0:0:mtail:/nonexistent:/usr/sbin/nologin # free: 386 # free: 387 # free: 388 diff --git a/sysutils/Makefile b/sysutils/Makefile index f6bfb55f82ae..01014a4d4076 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -754,6 +754,7 @@ SUBDIR += msiklm SUBDIR += msktutil SUBDIR += mstflint + SUBDIR += mtail SUBDIR += mtm SUBDIR += mtxorbd SUBDIR += mult diff --git a/sysutils/mtail/Makefile b/sysutils/mtail/Makefile new file mode 100644 index 000000000000..0f311248c5f0 --- /dev/null +++ b/sysutils/mtail/Makefile @@ -0,0 +1,44 @@ +PORTNAME= mtail +DISTVERSION= 3.0.9 +DISTVERSIONPREFIX= v +CATEGORIES= sysutils + +MAINTAINER= feld@FreeBSD.org +COMMENT= Extract internal monitoring data from application logs +WWW= https://github.com/google/mtail + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go:modules +GO_TARGET= ./cmd/mtail ./cmd/mfmt + +USE_GITHUB= yes +GH_ACCOUNT= google + +USE_RC_SUBR= mtail + +SUB_FILES+= pkg-message +SUB_LIST= USERS=${USERS} \ + ETCDIR=${ETCDIR} \ + DOCSDIR=${DOCSDIR} \ + EXAMPLESDIR=${EXAMPLESDIR} + +USERS= mtail +GROUPS= mtail + +DOCS= docs/*.md +EXAMPLES= examples/*.mtail + +OPTIONS_DEFINE= DOCS EXAMPLES + +# make gomod-vendor > Makefile.gomod +.include "${.CURDIR}/Makefile.gomod" + +post-install: + ${MKDIR} ${STAGEDIR}${DOCSDIR} + ${MKDIR} ${STAGEDIR}${EXAMPLESDIR} + ${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}/ + ${INSTALL_DATA} ${EXAMPLES:S,^,${WRKSRC}/,} ${STAGEDIR}${EXAMPLESDIR}/ + +.include <bsd.port.mk> diff --git a/sysutils/mtail/Makefile.gomod b/sysutils/mtail/Makefile.gomod new file mode 100644 index 000000000000..2c493983386f --- /dev/null +++ b/sysutils/mtail/Makefile.gomod @@ -0,0 +1,23 @@ +GH_TUPLE= \ + beorn7:perks:v1.0.1:beorn7_perks/vendor/github.com/beorn7/perks \ + census-ecosystem:opencensus-go-exporter-jaeger:v0.2.1:census_ecosystem_opencensus_go_exporter_jaeger/vendor/contrib.go.opencensus.io/exporter/jaeger \ + census-instrumentation:opencensus-go:v0.24.0:census_instrumentation_opencensus_go/vendor/go.opencensus.io \ + cespare:xxhash:v2.2.0:cespare_xxhash_v2/vendor/github.com/cespare/xxhash/v2 \ + davecgh:go-spew:v1.1.1:davecgh_go_spew/vendor/github.com/davecgh/go-spew \ + golang:glog:v1.2.2:golang_glog/vendor/github.com/golang/glog \ + golang:groupcache:41bb18bfe9da:golang_groupcache/vendor/github.com/golang/groupcache \ + golang:protobuf:v1.5.3:golang_protobuf/vendor/github.com/golang/protobuf \ + golang:sync:v0.7.0:golang_sync/vendor/golang.org/x/sync \ + golang:sys:v0.24.0:golang_sys/vendor/golang.org/x/sys \ + google:go-cmp:v0.6.0:google_go_cmp/vendor/github.com/google/go-cmp \ + google:go-genproto:daa745c078e1:google_go_genproto/vendor/google.golang.org/genproto \ + googleapis:google-api-go-client:v0.105.0:googleapis_google_api_go_client/vendor/google.golang.org/api \ + grpc:grpc-go:v1.56.3:grpc_grpc_go/vendor/google.golang.org/grpc \ + munnerz:goautoneg:a7dc8b61c822:munnerz_goautoneg/vendor/github.com/munnerz/goautoneg \ + pkg:errors:v0.9.1:pkg_errors/vendor/github.com/pkg/errors \ + prometheus:client_golang:v1.19.1:prometheus_client_golang/vendor/github.com/prometheus/client_golang \ + prometheus:client_model:v0.6.1:prometheus_client_model/vendor/github.com/prometheus/client_model \ + prometheus:common:v0.55.0:prometheus_common/vendor/github.com/prometheus/common \ + prometheus:procfs:v0.15.1:prometheus_procfs/vendor/github.com/prometheus/procfs \ + protocolbuffers:protobuf-go:v1.34.2:protocolbuffers_protobuf_go/vendor/google.golang.org/protobuf \ + uber:jaeger-client-go:v2.25.0:uber_jaeger_client_go/vendor/github.com/uber/jaeger-client-go diff --git a/sysutils/mtail/distinfo b/sysutils/mtail/distinfo new file mode 100644 index 000000000000..bbc154803f0b --- /dev/null +++ b/sysutils/mtail/distinfo @@ -0,0 +1,47 @@ +TIMESTAMP = 1767224635 +SHA256 (google-mtail-v3.0.9_GH0.tar.gz) = 16c59fe81d2b192bd57b988b00ca16f943ed85746ed2081de44127d5c7d0a439 +SIZE (google-mtail-v3.0.9_GH0.tar.gz) = 571625 +SHA256 (beorn7-perks-v1.0.1_GH0.tar.gz) = 98db84bb0224a26094e6adba91b7ee7a1a7ace28cb648d818f8e779e6a19f825 +SIZE (beorn7-perks-v1.0.1_GH0.tar.gz) = 10867 +SHA256 (census-ecosystem-opencensus-go-exporter-jaeger-v0.2.1_GH0.tar.gz) = 95d6a2259b26232de5c973a015ffac2ce3f822ae837b6a6532f40700c779964a +SIZE (census-ecosystem-opencensus-go-exporter-jaeger-v0.2.1_GH0.tar.gz) = 23336 +SHA256 (census-instrumentation-opencensus-go-v0.24.0_GH0.tar.gz) = 048708914541817193330ce052026deb0c617c9d953ac15ae601ab2bde5788d1 +SIZE (census-instrumentation-opencensus-go-v0.24.0_GH0.tar.gz) = 176752 +SHA256 (cespare-xxhash-v2.2.0_GH0.tar.gz) = b8c684b9e5e136510913727e6a845b28f8176e55db827b11f17769fba970fe13 +SIZE (cespare-xxhash-v2.2.0_GH0.tar.gz) = 12334 +SHA256 (davecgh-go-spew-v1.1.1_GH0.tar.gz) = 7d82b9bb7291adbe7498fe946920ab3e7fc9e6cbfc3b2294693fad00bf0dd17e +SIZE (davecgh-go-spew-v1.1.1_GH0.tar.gz) = 42152 +SHA256 (golang-glog-v1.2.2_GH0.tar.gz) = 5aa6cb3b9204b24d4f26fa475c84d337fe1dc47dc365e10199b88d2e70ad893d +SIZE (golang-glog-v1.2.2_GH0.tar.gz) = 36753 +SHA256 (golang-groupcache-41bb18bfe9da_GH0.tar.gz) = 1e89795970d6593affdafe1d09dcf947681ca1ea82528e8e4fb9974a77f2e394 +SIZE (golang-groupcache-41bb18bfe9da_GH0.tar.gz) = 26101 +SHA256 (golang-protobuf-v1.5.3_GH0.tar.gz) = 48457a6a9e8c78a7556ff5ff4a4c77d7df9bf70e882491ee0f3f1ff06db2bfaa +SIZE (golang-protobuf-v1.5.3_GH0.tar.gz) = 171822 +SHA256 (golang-sync-v0.7.0_GH0.tar.gz) = 39bf56d2dc04d16baabbf5eb5d847a2ad68762b5efde7ca3a8fdb24bdcdd9461 +SIZE (golang-sync-v0.7.0_GH0.tar.gz) = 18181 +SHA256 (golang-sys-v0.24.0_GH0.tar.gz) = 3402ba7b578406df222693bac2b4011b5c9ab9180b0c123db1ed92da8ba11052 +SIZE (golang-sys-v0.24.0_GH0.tar.gz) = 1501680 +SHA256 (google-go-cmp-v0.6.0_GH0.tar.gz) = d14f7d57b0f6d25771bee3d7d5d038f532539e71bfc934772b1c0467ab90fa86 +SIZE (google-go-cmp-v0.6.0_GH0.tar.gz) = 104784 +SHA256 (google-go-genproto-daa745c078e1_GH0.tar.gz) = 87a8a728aa937071545b8080654a8d2e6f4088227cc53215aa1101f7add10697 +SIZE (google-go-genproto-daa745c078e1_GH0.tar.gz) = 6013726 +SHA256 (googleapis-google-api-go-client-v0.105.0_GH0.tar.gz) = 821b0fec67835fdf03166c4b7929226e7db26c6eb09feff0708ac6d71f026dec +SIZE (googleapis-google-api-go-client-v0.105.0_GH0.tar.gz) = 30246907 +SHA256 (grpc-grpc-go-v1.56.3_GH0.tar.gz) = c3020aee3538563378c1b06e5a27f284bc6d615d7b9179017f7e7d0408bb0c4c +SIZE (grpc-grpc-go-v1.56.3_GH0.tar.gz) = 1944195 +SHA256 (munnerz-goautoneg-a7dc8b61c822_GH0.tar.gz) = 3a455e3bcf8237ecee0385f97223ca821ec2547284e827e90f94a4984801ca1c +SIZE (munnerz-goautoneg-a7dc8b61c822_GH0.tar.gz) = 2810 +SHA256 (pkg-errors-v0.9.1_GH0.tar.gz) = 56bfd893023daa498508bfe161de1be83299fcf15376035e7df79cbd7d6fa608 +SIZE (pkg-errors-v0.9.1_GH0.tar.gz) = 13415 +SHA256 (prometheus-client_golang-v1.19.1_GH0.tar.gz) = f707e66fc60a43ae135c493bfd16fd96d5033661d7af80e7c3a10a04212e72b0 +SIZE (prometheus-client_golang-v1.19.1_GH0.tar.gz) = 1083469 +SHA256 (prometheus-client_model-v0.6.1_GH0.tar.gz) = b9b690bc35d80061f255faa7df7621eae39fe157179ccd78ff6409c3b004f05e +SIZE (prometheus-client_model-v0.6.1_GH0.tar.gz) = 17373 +SHA256 (prometheus-common-v0.55.0_GH0.tar.gz) = b9cabec7dadf615ae8bf86414d916f6680bc9e641d7631deaad71422b104ab6b +SIZE (prometheus-common-v0.55.0_GH0.tar.gz) = 147527 +SHA256 (prometheus-procfs-v0.15.1_GH0.tar.gz) = ba96bb6d45f1fcbff820c7d844e6acdef4416bb0ff2d9e24656f5cbacb8e46b5 +SIZE (prometheus-procfs-v0.15.1_GH0.tar.gz) = 243687 +SHA256 (protocolbuffers-protobuf-go-v1.34.2_GH0.tar.gz) = a91d3129e38945b612b7a377364dae324ed3a489c3a805a412805a0cee76e7a2 +SIZE (protocolbuffers-protobuf-go-v1.34.2_GH0.tar.gz) = 1522818 +SHA256 (uber-jaeger-client-go-v2.25.0_GH0.tar.gz) = 92e34f0d49830c4a15c232a652a55128b0513d1c942195377a1dad4e3f382b99 +SIZE (uber-jaeger-client-go-v2.25.0_GH0.tar.gz) = 207404 diff --git a/sysutils/mtail/files/mtail.in b/sysutils/mtail/files/mtail.in new file mode 100644 index 000000000000..08d78818d895 --- /dev/null +++ b/sysutils/mtail/files/mtail.in @@ -0,0 +1,30 @@ +#!/bin/sh + +# PROVIDE: mtail +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +. /etc/rc.subr + +name=mtail +rcvar=mtail_enable + +load_rc_config $name + +: ${mtail_enable:=NO} +: ${mtail_user:=%%USERS%%} +: ${mtail_args:=""} + +pidfile="/var/run/${name}.pid" +procname="%%PREFIX%%/bin/mtail" +command="/usr/sbin/daemon" +command_args="-T ${name} -p ${pidfile} -u ${mtail_user} -f -H %%PREFIX%%/bin/mtail ${mtail_args}" +start_cmd=mtail_start + +mtail_start() +{ + echo "Starting ${name}." + ${command} ${command_args} +} + +run_rc_command "$1" diff --git a/sysutils/mtail/files/pkg-message.in b/sysutils/mtail/files/pkg-message.in new file mode 100644 index 000000000000..0cc1edde5ec1 --- /dev/null +++ b/sysutils/mtail/files/pkg-message.in @@ -0,0 +1,31 @@ +[ +{ type: install + message: <<EOM +To use mtail you will need to provide the service flags you want to +enable via the mtail_args setting in rc.conf. Most important is that +you need to specify a path for -progs and a comma separated list for +-logs which indicates the log files to monitor. The progs directory will +contain the .mtail files which define the rules and patterns it uses to +generate metrics from your log files. You can find examples for some +common services in %%EXAMPLESDIR%%. + +A working example for Apache might look like the following: + +mkdir -p %%ETCDIR%% +cp %%EXAMPLESDIR%%/apache_common.mtail %%ETCDIR%%/ + +In rc.conf: +mtail_enable="YES" +mtail_args="-address 127.0.0.1 -port 3903 -progs %%ETCDIR%% -logs /var/log/httpd-access.log" + +Now you can start the mtail service and it should begin providing the +Prometheus style metrics on http://127.0.0.1:3903/metrics. + +The documentation explaining the syntax can be found in %%DOCSDIR%%. +You may find examples for other common services on the internet. + +It is important to ensure the mtail service user can read the log files. + +EOM +} +] diff --git a/sysutils/mtail/pkg-descr b/sysutils/mtail/pkg-descr new file mode 100644 index 000000000000..e854613f934d --- /dev/null +++ b/sysutils/mtail/pkg-descr @@ -0,0 +1,9 @@ +mtail is a tool for extracting metrics from application logs to be +exported into a timeseries database or timeseries calculator for +alerting and dashboarding. + +It fills a monitoring niche by being the glue between applications that +do not export their own internal state (other than via logs) and +existing monitoring systems, such that system operators do not need to +patch those applications to instrument them or writing custom extraction +code for every such application. diff --git a/sysutils/mtail/pkg-plist b/sysutils/mtail/pkg-plist new file mode 100644 index 000000000000..d2a09f78b6dd --- /dev/null +++ b/sysutils/mtail/pkg-plist @@ -0,0 +1,34 @@ +bin/mfmt +bin/mtail +%%PORTDOCS%%%%DOCSDIR%%/Building.md +%%PORTDOCS%%%%DOCSDIR%%/Deploying.md +%%PORTDOCS%%%%DOCSDIR%%/Interoperability.md +%%PORTDOCS%%%%DOCSDIR%%/Language.md +%%PORTDOCS%%%%DOCSDIR%%/Metrics.md +%%PORTDOCS%%%%DOCSDIR%%/Programming-Guide.md +%%PORTDOCS%%%%DOCSDIR%%/Testing.md +%%PORTDOCS%%%%DOCSDIR%%/Troubleshooting.md +%%PORTDOCS%%%%DOCSDIR%%/debugging.md +%%PORTDOCS%%%%DOCSDIR%%/faq.md +%%PORTDOCS%%%%DOCSDIR%%/index.md +%%PORTDOCS%%%%DOCSDIR%%/reading-y-output.md +%%PORTDOCS%%%%DOCSDIR%%/references.md +%%PORTDOCS%%%%DOCSDIR%%/state.md +%%PORTDOCS%%%%DOCSDIR%%/style.md +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/apache_combined.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/apache_common.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/apache_metrics.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/dhcpd.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/histogram.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/lighttpd.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/linecount.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/mysql_slowqueries.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/nocode.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ntpd.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ntpd_peerstats.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/postfix.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/rails.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsyncd.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/sftp.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/timer.mtail +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/vsftpd.mtail |
