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

regex pattern to capture repeating groups/labels #153

Open
harishmk opened this issue May 11, 2021 · 2 comments
Open

regex pattern to capture repeating groups/labels #153

harishmk opened this issue May 11, 2021 · 2 comments

Comments

@harishmk
Copy link

harishmk commented May 11, 2021

msg rates = {client1=10, client2=20, client3=15, client4=23}

want to capture the above log line with client name as a label. number of clients is not fixed, i was trying this to extract the metric as dynamic list of labels.

msg rates = \{(%{NUMBER:client}=%{NUMBER:nmsgs}, )*%{NUMBER:client}=%{NUMBER:nmsgs}\}

this seem to capture only the last two items.
is there a way to get this working?
does the exporter use findAll?

@fstab
Copy link
Owner

fstab commented May 16, 2021

Do you want to create a new label name for each client, like client1="10", client2="20", client3="15", client4="23"? This is not possible. You have to define the labels names when you create the metric. Only the label values are dynamic.

@harishmk
Copy link
Author

with the regexp above i was able to create the labels dynamically, but it reports only the last two items.
for e.g: with {...client3=15, client4=23} it created client3=15, client4=23
and when the log changed to {...client6=8, client7=27} it created client6=8, client7=27

so it is possible to create dynamic labels, but the issue is that it is picking up only last item from the repeating group.

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