IIS使用nxloglogging到Logstash

我试图从IIS日志中joindate+时间字段到事件时间字段进行logstash消解。 这是我的nxlog.conf文件:

<Input iis1> #drop comment lines, join the date+time fields into an EventTime field, convert to json Module im_file File 'C:\inetpub\logs\LogFiles\W3SVC2\u_ex*.log' ReadFromLast TRUE Exec if $raw_event =~ /^#/ drop(); \ else \ { \ w3c->parse_csv(); \ $EventTime = parsedate($date + " " + $time); \ to_json (); \ } </Input> 

这是我得到的错误:

 2013-07-22 06:11:29 ERROR if-else failed at line 51, character 391 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 51, character 228 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; invalid modifier: '-' 

我不知道我还能怎么处理date+时间字段。 欢迎任何替代或build议。 谢谢!

您的w3c xm_csv模块实例的FieldType中可能有一个整数 。 不幸的是,它不能处理破折号“ – ”,并且不能将其parsing为一个整数。

您应该将UndefValue添加到您的CSV选项,以便它知道破折号意味着没有数据:

 <Extension w3c> Module xm_csv Fields $date $time $s-sitename $s-computername $s-ip $cs-method $cs-uri-stem $cs-uri-query $s-port $cs-username $c-ip $cs-version $cs-user-agent $cs-cookie $cs-referer $cs-host $sc-status $sc-substatus $sc-win32-status $sc-bytes $cs-bytes $time-taken Delimiter ' ' QuoteChar '"' EscapeControl FALSE UndefValue - </Extension>