AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题

问题[syslog](computer)

Martin Hope
Mr.P
Asked: 2023-04-22 15:09:29 +0800 CST

rSyslog 仅停止发送一些数据

  • 6

我已经通过 rsyslog TCP/SSL 配置了从我的一台服务器到中央日志服务器的远程日志记录

一切正常,直到昨天,大多数文件刚刚停止传输,而有些文件仍在日志服务器中发送/更新。

我的 /etc/rsyslog.d/ 中有这个特定的配置

$ModLoad imfile    #Load the imfile input module

# poll every 10s
$InputFilePollInterval 10

# myfile
$InputFileName /var/log/data/myFile.log 
$InputFileTag myFile: 
$InputFileStateFile stat-myFile  
$InputFileSeverity Info
$InputFileFacility local3
$InputRunFileMonitor

当我检查文件时,它会被我的应用程序更新

ls -la /var/log/data
-rw-r--r-- 1 adm adm  2666 Apr 22 08:52 myFile.log

当我尝试检查从该客户端到我的远程日志服务器的建立连接时,它似乎没问题(netstat -tulpan | grep syslog)

tcp        0      0 <clientIP>:42724       <serverIP>:10514      ESTABLISHED 31839/rsyslogd 

然而,当我检查日志服务器时,我将来自客户端的远程日志存储在 /var/log/remotelogs//

奇怪的是,一些文件(例如 systemd.log、sshd.log、rsyslogd.log、..)实时正确更新...但 myFile.log 不是

ls -la /var/remotelogs/<clientIP>
-rw-r----- 1 root root   1945150 Apr 21 15:07 myFile.log

如您所见.. 我的时间昨天下午 3 点左右它停止了... 是什么?还要检查服务器上的网络连接,一切似乎都是合法的......

$ sudo netstat -tulpan | grep syslog
tcp        0      0 0.0.0.0:10514           0.0.0.0:*               LISTEN      3608119/rsyslogd    
tcp        0      0 <serverIP>:10514      <clientIP>:42724       ESTABLISHED 3608119/rsyslogd      
tcp6       0      0 :::10514                :::*                    LISTEN      3608119/rsyslogd  

知道什么可能是错的吗?为什么有些文件没有传输而有些文件传输了?

syslog
  • 1 个回答
  • 12 Views
Martin Hope
CH06
Asked: 2022-01-05 03:33:03 +0800 CST

“-”符号到 rsyslog.conf 文件中

  • 5

我在“rsyslog.conf”中看到路径前有一个“-”符号,它是什么?

例子:

mail.info       -/var/log/mail.info
mail.err        /var/log/mail/err

谢谢

linux syslog
  • 1 个回答
  • 33 Views
Martin Hope
lord_sommersby
Asked: 2021-09-07 10:59:23 +0800 CST

正则表达式 char 类 - 更优雅的解决方案

  • 5

我有两个具有不同日志结构的梭子鱼固件和一个需要解析它们的 Logstash grok 过滤器插件。

值仅记录条目

+02:00 Info     blabla Detect: FWD|TCP|bond0.777|1.1.1.1|53329|00:00:00:00:00:00|20.190.159.32|443||bond1.182||0|80.231.71.252|20.190.159.32|0|1|0|0|0|0||SSL|Microsoft Services Base|graph.microsoft.com||Computing/Technology (82)

字段 + 值日志条目

+02:00 Info     blabla Remove: type=FWD|proto=UDP|srcIF=pvpn0|srcIP=1.1.1.1|srcPort=61661|srcMAC=00:00:00:00:00:00|dstIP=10.248.0.10|dstPort=53|dstService=dns|dstIF=pvpn0|rule=V2L-DNS-IN|info=Balanced Session Idle Timeout|srcNAT=10.248.11.215|dstNAT=127.0.0.1|duration=20|count=1|receivedBytes=444|sentBytes=82|receivedPackets=1|sentPackets=1|user=johba|protocol=|application=|target=|content=|urlcat=

对于第一个场景,我已经有了一个正则表达式。但是,我希望有一个在这两种情况下都匹配的正则表达式,无论提交的名称是否存在。

例如,我希望我的正则表达式同时匹配FWD和type=FWD

  1. 我首先尝试使用 char 类,即[type=]*\w+. 缺点是,例如,如果我有dstService=dns,并且我的正则表达式的部分是[dstService=]*\w+grok 过滤器将ns只匹配而不是dns
  2. 然后我尝试了d*s*t*S*e*r*v*i*c*e*=*\w+,这奏效了。但是,我在想是否有更优雅的方式来实现这个目标?
regex syslog
  • 1 个回答
  • 37 Views
Martin Hope
Kind Contributor
Asked: 2021-04-27 04:53:33 +0800 CST

/var/log/syslog 上的 gnome-shell 垃圾邮件

  • 6

从https://stackoverflow.com/questions/66061925/gnome-shell-spamming-on-var-log-syslog移出,因为它在没有解决方案的情况下在那里关闭;它目前也发生在我身上(我正在运行 Ubuntu 20.10,但没有标签)


我在 /var/log/syslog 中看到很多日志,所以我考虑过使用 rsyslog 将 gnome-shell 日志的输出重定向到 /dev/null,我不编辑 /etc/rsyslog 中的默认配置文件。 conf 将 00-my-file.conf 自定义文件创建到 /etc/rsyslog.d/ 到我创建的文件中,我编写了以下代码

如果 $msg 包含 'deallocated' 则 /dev/null

但它现在确实有效。带有“deallocated”的 gnome 日志打印字符串是 gnome 日志的一个示例

Feb  5 11:49:26 HP gnome-shell[1608]: == Stack trace for context 0x55e32619b220 ==
Feb  5 11:49:26 HP gnome-shell[1608]: #0   7fff4e657410 I   /usr/share/gnome-shell/extensions/[email protected]/docking.js:2051 (2a458f8a6330 @ 208)
Feb  5 11:49:26 HP gnome-shell[1608]: == Stack trace for context 0x55e32619b220 ==
Feb  5 11:49:26 HP gnome-shell[1608]: #0   7fff4e657410 I   /usr/share/gnome-shell/extensions/[email protected]/docking.js:2051 (2a458f8a6330 @ 208)
Feb  5 11:49:26 HP gnome-shell[1608]: == Stack trace for context 0x55e32619b220 ==
Feb  5 11:49:26 HP gnome-shell[1608]: #0   7fff4e657410 I   /usr/share/gnome-shell/extensions/[email protected]/docking.js:2051 (2a458f8a6330 @ 208)
Feb  5 11:49:26 HP gnome-shell[1608]: == Stack trace for context 0x55e32619b220 ==
Feb  5 11:49:26 HP gnome-shell[1608]: #0   7fff4e657410 I   /usr/share/gnome-shell/extensions/[email protected]/docking.js:2051 (2a458f8a6330 @ 208)
Feb  5 11:49:26 HP gnome-shell[1608]: == Stack trace for context 0x55e32619b220 ==
Feb  5 11:49:26 HP gnome-shell[1608]: #0   7fff4e657410 I   /usr/share/gnome-shell/extensions/[email protected]/docking.js:2051 (2a458f8a6330 @ 208)
Feb  5 11:49:26 HP gnome-shell[1608]: == Stack trace for context 0x55e32619b220 ==
Feb  5 11:49:26 HP gnome-shell[1608]: #0   7fff4e657410 I   /usr/share/gnome-shell/extensions/[email protected]/docking.js:2051 (2a458f8a6330 @ 208)
Feb  5 11:49:26 HP gnome-shell[1608]: == Stack trace for context 0x55e32619b220 ==
Feb  5 11:49:26 HP gnome-shell[1608]: #0   7fff4e657410 I   /usr/share/gnome-shell/extensions/[email protected]/docking.js:2051 (2a458f8a6330 @ 208)
Feb  5 11:49:26 HP gnome-shell[1608]: Object St.Bin (0x55e32b1423a0), has been already deallocated — impossible to set any property on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
Feb  5 11:49:26 HP gnome-shell[1608]: Object St.Bin (0x55e32a03fc80), has been already deallocated — impossible to set any property on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
Feb  5 11:49:26 HP gnome-shell[1608]: Object St.Bin (0x55e328c92fa0), has been already deallocated — impossible to set any property on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
Feb  5 11:49:26 HP gnome-shell[1608]: Object St.Bin (0x55e328f19080), has been already deallocated — impossible to set any property on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
Feb  5 11:49:26 HP gnome-shell[1608]: Object St.Bin (0x55e326ea8480), has been already deallocated — impossible to set any property on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.

如果你知道你解决了 gnome-shell 问题,请告诉我一个可能的解决方案。请帮助我,我会阅读所有回复。

syslog ubuntu-20.04
  • 1 个回答
  • 235 Views
Martin Hope
Nand0san
Asked: 2021-02-13 05:09:57 +0800 CST

SYSLOG-NG:将相同的日志发送到弹性搜索中的两个不同索引

  • 5

我正在尝试将相同的日志流发送到两个不同的弹性搜索索引,因为每个索引具有不同角色的用户。

我也使用文件作为目的地。这是一个示例:

2021-02-12T14:00:00+01:00 192.168.89.222 <30>1 2021-02-12T14:00:01+01:00 sonda filebeat 474 - - 2021-02-12T14:00:01.364+0100    DEBUG   [input] input/input.go:152      Run input
2021-02-12T14:00:00+01:00 192.168.89.222 <30>1 2021-02-12T14:00:01+01:00 sonda filebeat 474 - - 2021-02-12T14:00:01.364+0100    DEBUG   [input] log/input.go:191        Start next scan
2021-02-12T14:00:00+01:00 192.168.89.222 <30>1 2021-02-12T14:00:01+01:00 sensor filebeat 474 - - 2021-02-12T14:00:01.364+0100    DEBUG   [input] log/input.go:421        Check file for harvesting: /opt/zeek/logs/current/weird.log

当我只为 elasticsearch-http 使用一个目标时,配置了两个中的任何一个,一切正常,但是当同时使用两个目标时,syslog-ng 无法启动并且 systemcl 抱怨。

这是我的/etc/syslog-ng/syslog-ng.conf文件:

@version: 3.27
@include "scl.conf"
options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no);
      dns_cache(no); owner("root"); group("adm"); perm(0640);
      stats_freq(0); bad_hostname("^gconfd$");
};
source s_net { 
    udp( 
        ip(0.0.0.0) 
        port(514)
        flags(no-parse)
    );
};
log {
    source(s_net);
    destination(d_es);
    destination(d_es_other_index);   ######## comment this to avoid the error
    destination(d_file);
};

template t_demo_filetemplate {
    template("${ISODATE} ${HOST} ${MESSAGE}\n");
};

destination d_file {
    file("/tmp/test.log" template(t_demo_filetemplate));
};

destination d_es{
    elasticsearch-http(
        index("syslog-ng-${YEAR}-${MONTH}-${DAY}")
            url("https://192.168.89.44:9200/_bulk" "https://192.168.89.144:9200/_bulk")
        type("")
            user("elastic")
            password("password")
            batch_lines(128)
            batch_timeout(10000)
            timeout(100)
            template("$(format-json --scope rfc5424 --scope nv-pairs --exclude DATE --key ISODATE)")
        time-zone("UTC")
        tls(
            ca-file("/root/elastic_certs/elastic-ca.crt")       
            cert-file("/root/elastic_certs/elastic.crt")
            key-file("/root/elastic_certs/elastic.key")
            peer-verify(no)
        )
    );
};

destination d_es_other_index{
    elasticsearch-http(
        index("otherindex-${YEAR}-${MONTH}-${DAY}")
            url("https://192.168.89.44:9200/_bulk" "https://192.168.89.144:9200/_bulk")
        type("")
            user("elastic")
            password("password")
            batch_lines(128)
            batch_timeout(10000)
            timeout(100)
            template("$(format-json --scope rfc5424 --scope nv-pairs --exclude DATE --key ISODATE)")
        time-zone("UTC")
        tls(
            ca-file("/root/elastic_certs/elastic-ca.crt")
            cert-file("/root/elastic_certs/elastic.crt")
            key-file("/root/elastic_certs/elastic.key")
            peer-verify(no)
        )
    );
};

使用两个弹性搜索目标时出现的错误(journalctl -xe 似乎没有显示相关信息):

# systemctl restart syslog-ng.service
Job for syslog-ng.service failed because the control process exited with error code.
See "systemctl status syslog-ng.service" and "journalctl -xe" for details.

还有我的 syslog-ng 信息:

$ syslog-ng --version
syslog-ng 3 (3.27.1)
Config version: 3.22
Installer-Version: 3.27.1
Revision: 3.27.1-3build1
Compile-Date: Jul 30 2020 17:56:17
Module-Directory: /usr/lib/syslog-ng/3.27
Module-Path: /usr/lib/syslog-ng/3.27
Include-Path: /usr/share/syslog-ng/include
Available-Modules: syslogformat,afsql,linux-kmsg-format,stardate,affile,dbparser,geoip2-plugin,afprog,kafka,graphite,riemann,tfgetent,json-plugin,cef,hook-commands,basicfuncs,disk-buffer,confgen,timestamp,http,afamqp,mod-python,tags-parser,pseudofile,system-source,afsocket,afsnmp,csvparser,afstomp,appmodel,cryptofuncs,examples,afmongodb,add-contextual-data,afsmtp,afuser,xml,map-value-pairs,kvformat,redis,secure-logging,sdjournal,pacctformat
Enable-Debug: off
Enable-GProf: off
Enable-Memtrace: off
Enable-IPv6: on
Enable-Spoof-Source: on
Enable-TCP-Wrapper: on
Enable-Linux-Caps: on
Enable-Systemd: on

有没有办法同时做这两个弹性搜索索引?

linux syslog
  • 1 个回答
  • 243 Views
Martin Hope
lord_sommersby
Asked: 2020-08-04 21:43:44 +0800 CST

在 CentOS 8 上测试 syslog-ng

  • 5

我对 Linux 和网络比较陌生,但在工作中负责以下任务:我构建了一个 CentOS VM 机器(使用 VirtualBox),我必须在其上安装 Splunk Heavy Forwarder 和 syslog-ng。这个想法是 syslog-ng 将在端口上侦听传入日志并将它们写入文件。之后,我将在 Splunk 中摄取这些日志,对特定文件进行文件监控。

我遇到了两个问题。

  1. 我不确定我是否正确配置了 syslog-ng,因为我发现很难模拟流量。有人告诉我尝试使用 netcat。我所做的如下:
  • 我创建具有以下权限的 /var/log/syslog-ng/testlog.txt 文件 -rw-r--r--

  • 我在 syslog-ng.conf 中的源驱动程序 -

    源 s_test { 网络 ( ip("127.0.0.1") 传输("tcp") 端口(2514) ); };

  • 我的目的地司机是 -

目标 d_tests { 文件(“/var/log/syslog-ng/testlog.txt”);};

  • 我的日志语句是 -

    日志{源(s_test);目的地(d_test);目的地(d_tests);};

  • 我尝试使用 nc -q0 127.0.0.1 2514 模拟流量,但它会产生错误,即 q 是 nc 的无效选项。

任何帮助将非常感激。谢谢你。

logging syslog
  • 1 个回答
  • 328 Views
Martin Hope
JhonDoe
Asked: 2020-07-07 21:46:13 +0800 CST

了解 syslog 日志格式

  • 6

我从多台服务器获取 syslog,但我无法理解一些 syslog 日志,这是一个示例

<189>12593340: 16596512: Jul  6 20:31:09: %PARSER-5-CFGLOG_LOGGEDCMD: User:someuser  logged command:no 1480

<> 中的第一个数字是优先级,但后面的两个数字:“12593340”和“16596512”我不知道它们是什么。

有谁知道这些数字是什么?syslog 日志有多少种格式?

linux syslog
  • 1 个回答
  • 205 Views
Martin Hope
sarvesh.lad
Asked: 2019-12-19 10:53:21 +0800 CST

如何将系统日志严重性 <132> 保存到不同的文件?

  • 5

我们有一个旧设备将严重性为 <132> 的系统日志发送到其管理服务器。

为了捕获上述事件,之前的团队创建了一个 tcpdump 脚本并通过 crontab 运行它来捕获事件。

我试图弄清楚如何通过系统日志将这些事件写入不同的文件。

syslog 配置当前是默认配置,我启用了 UDP 捕获模块,但我无法让它写入不同的文件。

*.* /var/log/syslog_capture_all
:msg, contains, "[ApplianceModel]" /var/tmp/events_syslog

第一个文件现在包含来自系统的所有日志,第二个文件仍然是 emtpy。

apliance发送的日志如下,在tcpdump保存的文件中可以看到:

<132>[ApplianceModel] [Parameter=Parameter value] ......

我只想将“<132>[ApplianceModel] [Parameter=Parameter value] ......”保存到 /var/tmp/events_syslog 文件并摆脱那个 tcpdump

syslog centos-6
  • 1 个回答
  • 45 Views
Martin Hope
mikol
Asked: 2019-10-22 10:15:43 +0800 CST

rsyslog根据时间过滤消息

  • 5

我想过滤日志,以便只有 13:00-14:00 的消息可以通过,我该怎么做?我知道我可以使用 访问消息内容$msg,但我怎样才能做到这一点呢?

syslog
  • 1 个回答
  • 318 Views
Martin Hope
Xabache
Asked: 2019-06-18 19:16:00 +0800 CST

Debian 9 /var/log/ message、syslog、dmesg 可以安全地发布到论坛吗?

  • 6

在非常普通的 Debian 9 VPS 上,运行一个多人游戏系统,其中包含非常昂贵的脚本。我在那个多人游戏服务器上遇到了问题,其中一个服务器开发人员要求我公开发布我的 /var/log/ 系统日志和 dmesg。这些可以安全地发布到论坛吗?它们是否包含代码片段、Linux 服务器密码或用户名?

debian syslog
  • 1 个回答
  • 211 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve