我有一个 .net 应用程序的唯一日志文件,我尝试使用正则表达式尝试提取新的日志消息并发送到 syslog。
问题出在这个配置上,只需发送第一行。
这是我的示例 .log 文件:
2021-08-24 00:00:04,652:277045377 [25] ERROR [{log4net:HostName=eb8f19336600}] Crediware -
Type: Oracle.DataAccess.Client.OracleException
Message: ORA-12170: TNS:Connect timeout occurred
Source: Oracle Data Provider for .NET
Tracking id: 20309177202108241200046552088892
Server: EB8F19336600
UserMessage: Error al acceder a la base de datos
UserExtendedMessage:
Stack track:
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleConnectionOCP.Open(OracleConnection con)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Crediware.DataAccess._Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\_Connection.cs:line 169
at Crediware.DataAccess.Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Connection.cs:line 135
at Crediware.DataAccess.Manager.GetDataSet(String AppId, IDbCommand cmd) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Manager.cs:line 283
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId, ICache cache) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 121
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 87
2021-08-24 00:00:20,683:277061408 [25] ERROR [{log4net:HostName=eb8f19336600}] Crediware -
Type: Oracle.DataAccess.Client.OracleException
Message: Connection request timed out
Source: Oracle Data Provider for .NET
Tracking id: 9953899202108241200206838526507
Server: EB8F19336600
UserMessage: Connection request timed out
UserExtendedMessage:
Stack track:
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleConnectionOCP.Open(OracleConnection con)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Crediware.DataAccess._Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\_Connection.cs:line 169
at Crediware.DataAccess.Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Connection.cs:line 135
at Crediware.DataAccess.Manager.GetDataSet(String AppId, IDbCommand cmd) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Manager.cs:line 283
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId, ICache cache) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 121
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 87
2021-08-24 00:00:25,869:277066594 [25] ERROR [{log4net:HostName=eb8f19336600}] Crediware -
Type: Oracle.DataAccess.Client.OracleException
Message: ORA-12170: TNS:Connect timeout occurred
Source: Oracle Data Provider for .NET
Tracking id: 3906407120210824120025868086803
Server: EB8F19336600
UserMessage: Error al acceder a la base de datos
UserExtendedMessage:
Stack track:
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleConnectionOCP.Open(OracleConnection con)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Crediware.DataAccess._Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\_Connection.cs:line 169
at Crediware.DataAccess.Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Connection.cs:line 135
at Crediware.DataAccess.Manager.GetDataSet(String AppId, IDbCommand cmd) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Manager.cs:line 283
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId, ICache cache) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 121
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 87
2021-08-24 00:00:04,652:277045377 [25] ERROR [{log4net:HostName=eb8f19336600}] Crediware -
Type: Oracle.DataAccess.Client.OracleException
Message: ORA-12170: TNS:Connect timeout occurred
Source: Oracle Data Provider for .NET
Tracking id: 20309177202108241200046552088892
Server: EB8F19336600
UserMessage: Error al acceder a la base de datos
UserExtendedMessage:
Stack track:
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleConnectionOCP.Open(OracleConnection con)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Crediware.DataAccess._Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\_Connection.cs:line 169
at Crediware.DataAccess.Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Connection.cs:line 135
at Crediware.DataAccess.Manager.GetDataSet(String AppId, IDbCommand cmd) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Manager.cs:line 283
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId, ICache cache) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 121
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 87
2021-08-27 11:01:04,652:277045377 [25] ERROR [{log4net:HostName=eb8f19336600}] Crediware -
Type: Oracle.DataAccess.Client.OracleException
Message: ORA-12170: TNS:Connect timeout occurred
Source: Oracle Data Provider for .NET
Tracking id: 20309177202108241200046552088892
Server: EB8F19336600
UserMessage: Error al acceder a la base de datos
UserExtendedMessage:
Stack track:
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleConnectionOCP.Open(OracleConnection con)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Crediware.DataAccess._Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\_Connection.cs:line 169
at Crediware.DataAccess.Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Connection.cs:line 135
at Crediware.DataAccess.Manager.GetDataSet(String AppId, IDbCommand cmd) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Manager.cs:line 283
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId, ICache cache) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 121
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 87
这是我的 .conf
define ROOT C:\Program Files (x86)\nxlog
define CERTDIR %ROOT%\cert
define CONFDIR %ROOT%\conf
define LOGDIR %ROOT%\data
define LOGFILE %LOGDIR%\nxlog.log
LogFile %LOGFILE%
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
<Extension _gelf>
#Module xm_syslog
Module xm_gelf
#Module xm_json
</Extension>
<Extension multi>
Module xm_multiline
HeaderLine /^\d\d\d\d-/
</Extension>
<Input in>
Module im_file
File "c:\\logs\\crediware_backend\\applogs\\Crediware.back-2021-08-12.txt"
InputType multi
</Input>
<Output out>
Module om_udp
Host 172.28.36.25
Port 12201
#Exec to_syslog_snare();
OutputType GELF
</Output>
<Route 1>
Path in => out
</Route>
并尝试为每个新条目发送一条消息到 syslog,如下所示:
2021-08-24 00:00:04,652:277045377 [25] ERROR [{log4net:HostName=eb8f19336600}] Crediware -
Type: Oracle.DataAccess.Client.OracleException
Message: ORA-12170: TNS:Connect timeout occurred
Source: Oracle Data Provider for .NET
Tracking id: 20309177202108241200046552088892
Server: EB8F19336600
UserMessage: Error al acceder a la base de datos
UserExtendedMessage:
Stack track:
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
at Oracle.DataAccess.Client.OracleConnectionOCP.Open(OracleConnection con)
at Oracle.DataAccess.Client.OracleConnection.Open()
at Crediware.DataAccess._Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\_Connection.cs:line 169
at Crediware.DataAccess.Connection.Open() in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Connection.cs:line 135
at Crediware.DataAccess.Manager.GetDataSet(String AppId, IDbCommand cmd) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.DataAccess\Manager.cs:line 283
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId, ICache cache) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 121
at Crediware.Cache.Refresh.CacheRefresh.Refresh(String AppId) in C:\Usuario\SVN\Productos\Crediware\branches\develop\assemblies\Crediware.Cache.Refresh\CacheRefresh.cs:line 87
有人知道它的可能吗?我尝试使用“xm_multiline”模块的另一个选项,但对我不起作用
谢谢!