Multiline logfile support

Oct 3, 2012 at 2:04 PM
Edited Oct 3, 2012 at 2:04 PM

Greetings,
Are multiline logs matching returns only first Row?

Example:
.......
29 Jun 12 Command 1 output:
blah blah
29 Jun 12 Command 2 output
.......

Then we want to get "Command1 output" and everything else before next row marker (date or everything else repeated string).

What can we do with this point?

---------------------

I found this block of code in logfileutils

 

        // Read rows from log file
        while (matched_rows < cMaxMatchedRows && SCXStream::IsGood(*logfile))
        {
            wstring line;
            SCXStream::NLF nlf;
                    
            rows++;
                    
            SCX_LOGHYSTERICAL(m_log, StrAppend(L"LogFileProvider DoInvokeMethod - Reading row: ", rows));
                    
            SCXStream::ReadLine(*logfile, line, nlf);
                    
            // Check line against regular expressions and add to result if any matches
            std::wstring res(L"");
            int matches = 0;

            for (size_t j=0; j<regexps.size(); j++)
            {
                if (regexps[j].regex->IsMatch(line))
                {
                    SCX_LOGHYSTERICAL(m_log, StrAppend(StrAppend(StrAppend(L"LogFileProvider DoInvokeMethod - row: ", rows), 
                                                                 L" Matched regexp: "), regexps[j].index));
                    matches++;
                    res = StrAppend(StrAppend(res, res.length()>0?L" ":L""), regexps[j].index);
                }
            }
                    
            if (matches > 0)
            {
                matchedLines.push_back(StrAppend(StrAppend(res, L";"), line));
                matched_rows++;
            }
        }

        // Check if we read all rows, if not add special row to beginning of result
        if (matched_rows >= cMaxMatchedRows && SCXStream::IsGood(*logfile))
        {
            SCX_LOGINFO(m_log, StrAppend(L"LogFileProvider DoInvokeMethod - Breaking after matching max number of rows : ", cMaxMatchedRows));

            partialRead = true;
        }