Skip to content

Commit 6a34098

Browse files
Add vector agent for log export and aggregation
1 parent c139809 commit 6a34098

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

common/assets/vector.service

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[Unit]
2+
Description=Vector Log Aggregation Agent
3+
Documentation=https://vector.dev/docs/
4+
Wants=network-online.target
5+
After=network-online.target
6+
7+
[Service]
8+
User=prometheus
9+
Group=prometheus
10+
Type=simple
11+
ExecStart=/usr/bin/vector --config /etc/vector/vector.yaml
12+
ExecReload=/bin/kill -HUP $MAINPID
13+
Restart=always
14+
AmbientCapabilities=CAP_NET_BIND_SERVICE
15+
16+
[Install]
17+
WantedBy=multi-user.target

common/assets/vector/vector.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Vector configuration placeholder — configure at deployment time.
2+
# See https://vector.dev/docs/reference/configuration/
3+
4+
sources: {}
5+
sinks: {}

common/setup_monitoring.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@ cp /tmp/postgres_exporter-0.15.0.linux-${PROM_ARCH}/postgres_exporter /usr/bin/p
3939
chown ubi_monitoring:ubi_monitoring /usr/bin/postgres_exporter
4040
chmod 100 /usr/bin/postgres_exporter
4141

42+
VECTOR_VERSION="0.54.0"
43+
44+
# Install Vector
45+
echo "[setup_monitoring.sh] Downloading Vector v${VECTOR_VERSION}..."
46+
case $ARCH in
47+
x86_64) VECTOR_ARCH="x86_64" ;;
48+
aarch64) VECTOR_ARCH="aarch64" ;;
49+
esac
50+
wget https://github.com/vectordotdev/vector/releases/download/v${VECTOR_VERSION}/vector-${VECTOR_VERSION}-${VECTOR_ARCH}-unknown-linux-musl.tar.gz -P /tmp
51+
tar -xzvf /tmp/vector-${VECTOR_VERSION}-${VECTOR_ARCH}-unknown-linux-musl.tar.gz -C /tmp
52+
cp /tmp/vector-${VECTOR_ARCH}-unknown-linux-musl/bin/vector /usr/bin/vector
53+
chown prometheus:prometheus /usr/bin/vector
54+
chmod 100 /usr/bin/vector
55+
mkdir -p /etc/vector
56+
cp /tmp/common/assets/vector/vector.yaml /etc/vector/vector.yaml
57+
chown -R prometheus:prometheus /etc/vector
58+
4259
echo "=== [setup_monitoring.sh] Installing systemd service files ==="
4360

4461
# Copy systemd unit files
@@ -48,6 +65,7 @@ cp /tmp/common/assets/node_exporter.service /etc/systemd/system/node_exporter.se
4865
mkdir -p /var/lib/node_exporter
4966
cp /tmp/common/assets/postgres_exporter.service /etc/systemd/system/postgres_exporter.service
5067
cp /tmp/common/assets/wal-g.service /etc/systemd/system/wal-g.service
68+
cp /tmp/common/assets/vector.service /etc/systemd/system/vector.service
5169

5270
# Copy postgres_exporter queries
5371
mkdir -p /usr/local/share/postgresql

0 commit comments

Comments
 (0)