IIS 로그 파일의 홀수 문자로 인해 nxlog pars_csv가 실패합니다.

IIS 로그 파일의 홀수 문자로 인해 nxlog pars_csv가 실패합니다.

IIS 로그를 구문 분석하고 있습니다.

이 오류는 내 nxlog 이벤트 로그에 표시됩니다.

2013-12-24 18:40:20 ERROR if-else failed at line 50, character 351 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; procedure 'parse_csv' failed at line 50, character 225 in C:\Program Files (x86)\nxlog\conf\nxlog.conf. statement execution has been aborted; Invalid CSV input: '2012-06-20 14:31:37 10.1.0.16 GET /App_Themes/Authenticated/Styles/index.jsp - 80 - 192.168.0.93 "|dir 302 0 0 62'

이것은 로그 파일의 행을 더 잘 보여줍니다.

2012-06-20 14:31:37 10.1.0.16 GET /App_Themes/Authenticated/Styles/index.jsp - 80 - 192.168.0.93 |dir 302 0 0 62

이것은 내 nxlog.conf 파일입니다. 나머지는 단지 라우팅이기 때문에 51번째 줄에서 잘라냈습니다.

define ROOT C:\Program Files (x86)\nxlog

Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log

SuppressRepeatingLogs TRUE
LogLevel INFO


#<Extension fileop>
#    Module      xm_fileop
#    <Schedule>
#        Every   1 hour
#        Exec    file_cycle('%ROOT%\data\nxlog.log', 5);
#    </Schedule>
#</Extension>

<Extension syslog>
    Module      xm_syslog
</Extension>

<Extension json>
    Module      xm_json
</Extension> 

<Extension w3c>
    Module      xm_csv
    Fields  $date, $time, $s-ip, $cs-method, $cs-uri-stem, $cs-uri-query, $s-port, $cs-username, $c-ip, $cs-User-Agent, $sc-status, $sc-substatus, $sc-win32-status, $time-taken
    FieldTypes  string, string, string, string, string, string, string, string, string, string, string, string, string, string
    Delimiter   ' '
    QuoteChar   '"'
    EscapeControl FALSE
    UndefValue  -
</Extension>


<Input iis_in>
    Module  im_file
    File    "f:\\iislogs\\u_*.log"
    ReadFromLast FALSE
    Exec    if $raw_event =~ /^#/ drop();                        \
                else                                             \
                {                                                \
                    w3c->parse_csv();                            \
                    $EventTime = parsedate($date + " " + $time); \
                    to_json(); \
                }
</Input>
  1. 이것이 내가 걱정해야 할 일입니까?
  2. " 캐릭터 때문에 폭탄이 터지는 걸까요?
  3. 이것을 어떻게 피할 수 있습니까?

편집: 추가 연구에 따르면 이는 "cs(User-Agent)" 필드의 문자가 잘못 코딩되었기 때문일 수 있습니다. 그것에 대해 무엇을 해야할지 잘 모르겠습니다.

#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
2012-02-04 22:09:37 10.1.0.16 GET /login.aspx - 80 - 192.168.0.93 +xa7 403 4 5 218
2012-02-04 22:09:37 10.1.0.16 GET /signup/ - 80 - 192.168.0.93 +xa7 302 0 0 15
2012-02-04 22:09:37 10.1.0.16 GET /signup/ - 80 - 192.168.0.93 " 302 0 0 15
2012-02-04 22:09:37 10.1.0.16 GET /signup/ - 80 - 192.168.0.93 ߧߢ 302 0 0 0
2012-02-04 22:09:37 10.1.0.16 GET /signup/ - 80 - 192.168.0.93 

답변1

있는지 여부가 조금 불분명합니다."입력 내용에 문자가 포함되어 있는지 여부. QuoteChar를 큰따옴표가 아닌 다른 것으로 설정해 보세요.

관련 정보