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

multiline_regex_before won't work when logfile ends with empty line #403

Open
jeroenmaelbrancke opened this issue Apr 25, 2016 · 2 comments

Comments

@jeroenmaelbrancke
Copy link
Contributor

Hello,

I still got some troubles when i'm using the multiline_regex_before with empty_lines...
I found out that if the last entry in your logfile is empty he will print all lines separately.

my logfile:
2016/04/25 06:48:18 919733 +0200 - cmp05 - 6747/0 - alba/proxy - 57397 - info - ETCD: etcdctl --peers=127.0.0.1:2379 set ovs/vpools/26ecee0c-a3ea-4d37-a245-3b0c0e18823b/proxies/890c3734-a8d6-47ec-ab59-b1d489c0b83c/config/abm [global]; cluster_id = ; cluster = ElLfeK1QfHheHtGO, ABSjdH4ybJRukOwD, wFWnl7M9oFjZMUKj; ; [wFWnl7M9oFjZMUKj]; client_port = ; ip = ; ; [ABSjdH4ybJRukOwD]; client_port = ; ip = ; ; [ElLfeK1QfHheHtGO]; client_port = ; ip = ;
[global]
cluster_id =
cluster = ElLfeK1QfHheHtGO, ABSjdH4ybJRukOwD, wFWnl7M9oFjZMUKj

[wFWnl7M9oFjZMUKj]
client_port =
ip =

[ABSjdH4ybJRukOwD]
client_port =
ip =

[ElLfeK1QfHheHtGO]
client_port =
ip =

2016/04/25 06:48:31 555754 +0200 - cmp05 - 6747/0 - alba/proxy - 57398 - info - update_osds

my beaver config
[/var/log/upstart/.log]
multiline_regex_before = ^[^\d{4}/\d{2}/\d{1,2}].

ignore_empty: 1
type: other
tags: other

You could easily fix this if you add
for line in lines:
if line == '':
break
....

in your multiline_merge function [https://github.com/python-beaver/python-beaver/blob/master/beaver/utils.py#L199]

Can you please fix this?

@josegonzalez
Copy link
Member

Can you make a PR for your fix?

@jeroenmaelbrancke
Copy link
Contributor Author

Could you please have a look at the PR?
PR-404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants