Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[filebeat/postgresql] Multiline pattern is too permissive/generic #12078

Closed
tsouza opened this issue May 6, 2019 · 2 comments
Closed

[filebeat/postgresql] Multiline pattern is too permissive/generic #12078

tsouza opened this issue May 6, 2019 · 2 comments
Assignees
Labels
bug Filebeat Filebeat module Team:Integrations Label for the Integrations team

Comments

@tsouza
Copy link

tsouza commented May 6, 2019

The multiline pattern used for postgres ^[-0-9]* is too permissive and it will match a line that starts with a space.

The following is a sample postgres log that fails creating proper multiline event since it has log lines that starts with a space:

2019-05-06 19:00:04.511 UTC [913763] elastic@opbeans LOG:  duration: 0.753 ms  statement: SELECT p.id, p.sku, p.name, p.stock, t.name AS type_name FROM products p LEFT JOIN product_types t ON p.type_id=t.id
    FROM orders JOIN customers ON orders.customer_id=customers.id
    FROM products JOIN product_types ON type_id=product_types.id

I think the test data here https://github.com/elastic/beats/blob/v7.0.0/filebeat/module/postgresql/log/test/postgresql-9.6-debian-with-slowlog.log does not catches this error because it starts with a tab instead of a space char, so the sample there fails ^[-0-9]* .

The recommended fix here is to use a more specific date pattern like ^\d{4}-\d{2}-\d{2} . Alternatively, use + instead of *, like in ^[-0-9]+ , which does not allows lines starting with a space.

Filebeat Version: 7.0.0
Postgres Version: 9.6.2

@exekias exekias added the Team:Integrations Label for the Integrations team label May 8, 2019
@andresrc andresrc self-assigned this May 20, 2019
@andresrc andresrc removed their assignment May 20, 2019
@andresrc andresrc self-assigned this Jun 3, 2019
@andresrc andresrc removed their assignment Jun 17, 2019
@sayden
Copy link
Contributor

sayden commented Jul 25, 2019

Hi @tsouza and thank you for the heads up 🙂

I have been experimenting with your suggestions and I have finally opened a PR to solve this here #13069

Feel free to comment and thank you again 🙂

@sayden
Copy link
Contributor

sayden commented Oct 9, 2019

Closing this after PR's were merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Filebeat Filebeat module Team:Integrations Label for the Integrations team
Projects
None yet
Development

No branches or pull requests

4 participants