elasticsearch,fluentd,Regex,elasticsearch,Fluentd" /> elasticsearch,fluentd,Regex,elasticsearch,Fluentd" />

Regex 模式不匹配fluentd elasticsearch

Regex 模式不匹配fluentd elasticsearch,regex,elasticsearch,fluentd,Regex,elasticsearch,Fluentd,我正在用fluentd编写magento异常日志的日志格式 异常日志的单个异常 [2016-04-30 11:37:42] main.CRITICAL: exception 'Exception' with message 'Report ID: webapi-571f53065307a; Message: Notice: Array to string conversion in /var/www/html/magento2/vendor/monolog/monolog/src/Monolog

我正在用fluentd编写magento异常日志的日志格式

异常日志的单个异常

[2016-04-30 11:37:42] main.CRITICAL: exception 'Exception' with message 'Report ID: webapi-571f53065307a; Message: Notice: Array to string conversion in /var/www/html/magento2/vendor/monolog/monolog/src/Monolog/Logger.php on line 277' in /var/www/html/magento2/vendor/magento/framework/Webapi/ErrorProcessor.php:194
Stack trace:
#0 /var/www/html/magento2/vendor/magento/framework/Webapi/ErrorProcessor.php(139): Magento\Framework\Webapi\ErrorProcessor->_critical(Object(Exception))
#1 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(163): Magento\Framework\Webapi\ErrorProcessor->maskException(Object(Exception))
#2 /var/www/html/magento2/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(24): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
#3 /var/www/html/magento2/vendor/magento/framework/App/Http.php(115): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#4 /var/www/html/magento2/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#5 /var/www/html/magento2/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#6 {main} [] []
注意:总共有9行(但总行数因例外情况而异)

我的异常日志格式的正则表达式模式是

/^\[(?<Time>[^ ]* [^ ]*)\] (?<Level>[^ ]*): (?<Exception>.*\n.*):(?<StackTrace>.*\n)$/

谢谢

您正在使用字符类
[]
和不必要的
$
。我对你的正则表达式做了一些修改,效果很好

(?<Time>[^ ]* [^ ]*)\ (?<Level>[^ ]*): (?<Exception>[^\n]+)\n*(?<StackTrace>Stack trace:)

您正在使用字符类
[]
和不必要的
$
。我对你的正则表达式做了一些修改,效果很好

(?<Time>[^ ]* [^ ]*)\ (?<Level>[^ ]*): (?<Exception>[^\n]+)\n*(?<StackTrace>Stack trace:)

您想要输出什么?我不知道fluentd的情况,但是如果您仍然有问题,请在问题中添加您的fluentd配置。您想要输出什么?我不知道fluentd的情况,但是如果您仍然有问题,请在问题中添加您的fluentd配置。@BilalUsean请注意,我修改的正则表达式在以下情况下效率很低:failure@BilalUsean请注意,我修改的正则表达式在出现故障时效率很低
(\[[^]]+\])\s+([^:]+):\s+([^\n]+)\n*(Stack trace:)\n