From f2f373b996c331e5fccb371630ad503dcbb8327d Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Fri, 11 Jul 2025 11:58:28 +0200 Subject: [PATCH] refs #2448 #2449 configure and run filebeat --- CHANGELOG.md | 6 ++++++ ogclient/etc/preinit/default.sh | 2 +- ogclient/etc/preinit/filebeat.sh | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 ogclient/etc/preinit/filebeat.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c26e63..40b7ce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.24.0] - 2025-07-11 + +### Added + +- Configure and run filebeat + ## [0.23.2] - 2025-07-07 ### Changed diff --git a/ogclient/etc/preinit/default.sh b/ogclient/etc/preinit/default.sh index a012b32..3740c30 100755 --- a/ogclient/etc/preinit/default.sh +++ b/ogclient/etc/preinit/default.sh @@ -5,7 +5,7 @@ set -a source /opt/opengnsys/etc/preinit/loadenviron.sh # Scripts de inicio. -for f in cleanesp fileslinks loadmodules metadevs mountrepo poweroff otherservices; do +for f in cleanesp fileslinks loadmodules metadevs mountrepo poweroff filebeat otherservices; do source $OGETC/preinit/$f.sh done unset f diff --git a/ogclient/etc/preinit/filebeat.sh b/ogclient/etc/preinit/filebeat.sh new file mode 100755 index 0000000..cec6567 --- /dev/null +++ b/ogclient/etc/preinit/filebeat.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +F=/etc/filebeat/filebeat.yml +OGLOG_PORT=9200 + +if [ -f $F ]; then + PASS=$(grep "^[ ]*\(export \)\?OPTIONS=" /scripts/ogfunctions 2>&1 |sed 's/\(.*\)pass=\(\w*\)\(.*\)/\2/') ## taken from a sibling script + PASS=${PASS:-"og"} + chmod 0600 $F + sed -i -e "s/__OGLOG_IP__/$oglog/g" \ + -e "s/__OGLOG_PORT__/$OGLOG_PORT/g" \ + -e "s/__OPENSEARCH_PASSWORD__/$PASS/g" \ + $F + unset PASS + + mkdir -p /var/log/filebeat + /usr/bin/filebeat -c $F --path.home /usr/share/filebeat --path.config /etc/filebeat --path.data /var/lib/filebeat --path.logs /var/log/filebeat & +fi