edit-icon download-icon

Configure a regular expression

Last Updated: Apr 19, 2018

To configure Logtail to collect text logs, you must configure a regular expression based on your log sample if you select to use the Full Mode to parse logs.

Log Service supports automatically generating the regular expression. Paste your log sample in the Log Sample field to automatically generate the regular expression.

If the automatically generated regular expression do not fully cover your log sample, you can also write a regular expression manually by referring to the regular expression sample of Apache (for more information, see Apache logs).

Take the standard Nginx access logs as an example.

  1. Configure parts of the regular expression first and use .* for the other parts.

    (\d+.\d+.\d+.\d+)(.*)

  2. Modify the regular expression based on the log sample.

    (\d+.\d+.\d+.\d+)\s(\d+)(.*)

If you have any issues, contact our after-sales support.

Thank you! We've received your feedback.