Pattern for logstash

432 views Asked by At

I try to use logstach for visualisation logs from our website.

Our conf

input {
    file {
        path => 'f:/tst/zp/*zp*.log'
        type => 'app'
        start_position =>'end'
    }
}

filter {
    multiline {
        pattern => ???
        what => 'previous'
        negate => true
     }
}  
output { 
  stdout { codec => rubydebug }
  elasticsearch { embedded => true }
}

Our log example (Enterprise library)

----------------------------------------
16.08.2012 6:46:40 [1476] [Error] General 

Message: Error
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at ZCommon.Model.Search.VacancySearchArgs.<MakeSql>b__d(String[] x) in d:\Builds\Sources\DM_Zarplata4.2_Retail3\DM_Zarplata\Zarplata4\releases\current\ZCommon4.4\Model\Search\VacancySearchArgs.cs:line 126


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

Can you help with pattern? I use http://grokdebug.herokuapp.com/ for making pattern, but pattern isn't work.

1

There are 1 answers

0
Ban-Chuan Lim On BEST ANSWER

Try this pattern

filter {
    multiline {
        pattern => "^[0-9]{2}\.[0-9]{2}\.[0-9]{4}"
        what => 'previous'
        negate => true
    }
}

It's works on me. The pattern is used to filter the date.