Extraction of Log Messages

where and how to write the custom filters to extract required fields in syslog message:

please anyone suggest me where and how to write extraction logic,and where the default filters in logstash are located
-thanks

Have you looked at the documentation's configuration examples?