Skip to content

Commit

Permalink
net-misc/loki-promtail-bin add ebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
ibra-adjust committed Mar 18, 2024
1 parent dad9e0b commit 4de2c97
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions net-misc/loki-promtail-bin/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST loki-promtail-bin-2.9.5.zip 26837462 BLAKE2B 56ea6438ca32a68a004961dba6d43b0340adc9cf9cdd4287d40024ccbda320bd19b9fc75764e7bcc5c89bd3348c51000b9b7b3691b7757e1c6062d0d7b61197c SHA512 652fa8aef13b5c58ed27e213557eb161a0fce607558ed79f5a6cf4adcfbb4cc9b49d9b2d58afc9b18100eebe5ba0d957dcc0ef26a9205dc71f2ec24800110f7c
16 changes: 16 additions & 0 deletions net-misc/loki-promtail-bin/files/promtail.initd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/sbin/openrc-run
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

name="Loki Promtail"
description="Promtail is a logs agent"
command="/opt/bin/promtail"
command_args="-config.file /etc/promtail.yml"
command_background="true"
pidfile="/var/run/${RC_SVCNAME}.pid"
output_logger="logger -p daemon.info -t ${SVCNAME}"
error_logger="logger -p daemon.error -t ${SVCNAME}"

depend() {
after net
}
18 changes: 18 additions & 0 deletions net-misc/loki-promtail-bin/files/promtail.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server:
http_listen_port: 9080
grpc_listen_port: 0

positions:
filename: /tmp/positions.yaml

clients:
- url: 'http://localhost:3100/loki/api/v1/push'

scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*log
39 changes: 39 additions & 0 deletions net-misc/loki-promtail-bin/loki-promtail-bin-2.9.5.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="Promtail is an agent which ships the contents of local logs to a Loki instance."
HOMEPAGE="https://grafana.com/loki"
SRC_URI="https://github.com/grafana/loki/releases/download/v${PV}/promtail-linux-amd64.zip -> ${P}.zip"

S="${WORKDIR}"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"

DEPEND="
app-arch/zip
>=dev-lang/go-1.13:*
"

QA_PREBUILT="/opt/bin/promtail"
QA_PRESTRIPPED="/opt/bin/promtail"

RESTRICT="mirror strip"

src_install() {
newinitd "${FILESDIR}/promtail.initd" "promtail"
dodoc *.md
into /opt
newbin promtail-linux-amd64 promtail
insinto /etc
doins "${FILESDIR}/promtail.yml"
}

pkg_postinst() {
einfo
einfo "Please make sure to modify /etc/promtail.yml before starting Promtail!"
einfo
}

0 comments on commit 4de2c97

Please sign in to comment.