- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试在 CentOS 7 环境中获取 filebeat(用于 logstash 转发)以在我创建的用户帐户下运行:filebeat 而不是 root。我尝试将 /etc/rc.d/init.d/filebeat
文件编辑为以下内容,但无济于事。我可能做错了什么,但对 BASH 脚本编写还是有点陌生,我可能把它放在了错误的地方?我试图按照位于 here 的建议实现说明进行操作
为简洁起见,我只展示上述文件的第一部分,因为后面的部分没有变化:
#!/bin/bash
#
# filebeat filebeat shipper
#
# chkconfig: 2345 98 02
#
### BEGIN INIT INFO
# Provides: filebeat
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Sends log files to Logstash or directly to Elasticsearch.
# Description: filebeat is a shipper part of the Elastic Beats
# family. Please see: https://www.elastic.co/products/beats
### END INIT INFO
PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH
[ -f /etc/sysconfig/filebeat ] && . /etc/sysconfig/filebeat
pidfile=${PIDFILE-/var/run/filebeat.pid}
agent=${PB_AGENT-/usr/bin/filebeat}
args="-c /etc/filebeat/filebeat.yml"
test_args="-e -configtest"
wrapper="filebeat-god"
wrapperopts="-r / -n -p $pidfile"
RETVAL=0
service_user="filebeat"
# Source function library.
. /etc/rc.d/init.d/functions
# Determine if we can use the -p option to daemon, killproc, and status.
# RHEL < 5 can't.
if status | grep -q -- '-p' 2>/dev/null; then
daemonopts="--user $service_user --group $service_group --pidfile $pidfile"
**chown -R $service_user /etc/filebeat || return 1
chown $service_user $pidfile || return 1
chmod g+w $pidfile || return 1**
pidopts="-p $pidfile"
touch
fi
之前我使用类似于以下内容创建了一个用户帐户 filebeat:
useradd filebeat -u 5044 -c "Filebeat Service Account" -d /dev/null -s /sbin/nologin
但是,当我在启动后尝试查看进程时,它仍然显示为 root 拥有:
[root@testvm ~]# ps -aef | grep filebeat
root 26030 1 0 13:16 ? 00:00:00 /usr/bin/filebeat -c /etc/filebeat/filebeat.yml
最佳答案
在 RHEL/CentOS 7 上,systemd 管理服务,因此不使用 init.d 文件。您应该修改 Filebeat 的单元文件,以便以不同的用户身份运行该服务。单元文件安装在 /lib/systemd/system/filebeat.service
。
您需要在 Service
部分添加一个 User
选项。
[Service]
User=<username>
用户必须对日志文件具有读取权限,并且必须对包含日志文件的目录具有搜索权限(执行位)。 Filebeat 使用 stat
收集文件的 inode ,stat
根据其 man page 需要目录的执行权限。 .
关于linux - centos 7 的 logstash filebeat 服务帐户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38944786/
我在 logstash 中使用文件作为日志的输入。我的日志文件每天轮换,所以我想问一下我们如何配置 logstash 的文件插件,以便它可以处理每天轮换的文件。除此之外,文件节拍也可以进行日志轮换。
我正在我公司服务的服务器上实现监控工具。为此,我正在使用 logstash。我们的应用程序通过 log4net udp appender 将它们的日志发送到 logstash(输入 udp),然后 l
我期待对 Logstash 中收到的输入使用数学运算,但无法看到任何此类 过滤器 . 输入如下: { "user_id": "User123", "date": "2016 Jun 26 12
我对 logstash 和 Elasticsearch 很陌生。我正在尝试将日志文件存储在 elasticsearch 和平面文件中。我知道 logstash 支持两种输出。但是它们是同时处理的吗?还
寻求一些入门帮助...我已经安装了 Logstash(以及 ElasticSearch),但我正在为我的第一个过滤器而苦苦挣扎。 作为测试,我将其配置为从包含 6 行的修剪日志文件中读取,每行以时间戳
我已经按照下面提到的架构实现了 logstash(在测试中)。 成分分解 Rsyslog 客户端:默认情况下,所有 Linux destros 中都安装了 syslog,我们只需要配置 rsyslog
我无法在 LogStash 中使用负正则表达式(如 the docs 中所述) 考虑以下正则表达式,它可以正常工作以检测已分配值的字段: if [remote_ip] =~ /(.+)/ {
我在云中使用两台服务器,在一台服务器上 (A) 我安装了 filebeat,在第二台服务器上 (B) 我安装了 logstash、elasticsearch 和 kibana。所以我在 logstas
我有一个来自 Windows 事件日志的 IP 地址字段,它在 IP 地址前面包含类似“::fffff:”的字符。我无法在此处更改源,因此我必须在 Logstash 中修复此问题。 我一定很不擅长谷歌
我正在尝试将此日期结构 YYYY-MM-DD_HH-MM-SS 转换为 logstash 中的 YYYY-MM-DD HH:MM:SS。这是我的过滤器: filter { csv {
我正在使用 Logstash(以 Kibana 作为 UI)。我想从我的日志中提取一些字段,以便我可以在 UI 的 LHS 上按它们进行过滤。 我日志中的示例行如下所示: 2013-07-04 00:
如何将此 Logstash 过滤器更改为不区分大小写? filter { if "foo" in [message] { mutate { add_field => { "Alert_le
我正在尝试将事件消息与几个正则表达式相匹配。我打算使用 grep 过滤器,但它已被弃用,所以我正在尝试使用否定的方法。 我正在寻找的功能是删除所有事件,除非消息匹配多个正则表达式。 过滤器波纹管不起作
我用过logstash的RPM安装。因此,logstash 作为 linux 服务运行。我想调试一个管道,需要查看的内容 output { stdout { codec => rubydebug
如何在 logstash 中比较日期。我想将日期与恒定日期值进行比较。以下代码在 Logstash 中失败并出现 ruby 异常。 if [start_dt] { "str_dt" => "20
我正在从logstash-1.1.3升级到logstash-1.3.3。问题是,1.1.3 中的标签和字段配置在 1.3.3 版本中已弃用。这些允许仅将那些事件发送到具有给定标签或包含给定字段的输出。
我想在同一台机器上运行两个 logstash 实例。现在我使用命令启动 logstash。logstash.bat agent -f logstashconf.conf。但是当我要通过相同的命令启动第
我有这种格式的 php 日志 [Day Mon DD HH:MM:SS YYYY] [Log-Type] [client ] : [Day Mon DD HH:MM:SS YYYY] [Log-Ty
我的 logstash 中的一些请求使 http 输出插件失败,并且日志显示 [2020-10-16T18:44:54,574][ERROR][logstash.outputs.http ] [HTT
我正在探索Logstash来接收HTTP上的输入。我已经使用以下方法安装了http插件: 插件安装logstash-input-http 安装成功。然后我尝试使用以下命令运行logstash: log
我是一名优秀的程序员,十分优秀!