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

how filter fields separated by dashes #52

Closed
gatspy opened this issue Feb 17, 2022 · 3 comments
Closed

how filter fields separated by dashes #52

gatspy opened this issue Feb 17, 2022 · 3 comments
Labels

Comments

@gatspy
Copy link

gatspy commented Feb 17, 2022

fblog -f 'method=="POST" and header.X-Customer-Id[1]=="123456"' -a body -a res_body req.log
{
  "header":{
      "X-Tenant-Id": ["123456"]
  }
}
@bomgar
Copy link
Member

bomgar commented Feb 17, 2022

You can use --print-lua to see what variables fblog creates. In your example it looks like this:

header = {X_Tenant_Id = {"123456","343434"}}

So with your example this seems to work:

» cat sample_array_dashes.json
{"header":{"X-Tenant-Id": ["123456", "343434"]}}
» fblog --print-lua -f 'header.X_Tenant_Id[1] == "123456"' -d sample_array_dashes.json
header = {X_Tenant_Id = {"123456","343434"}}
                    UNKNO:
  header > X-Tenant-Id[1]: "123456"
  header > X-Tenant-Id[2]: "343434"

I haven't encountered arrays in log files yet so there is probably room for improvement. Let me know.

@bomgar
Copy link
Member

bomgar commented Feb 17, 2022

I added --print-lua to the readme

@gatspy
Copy link
Author

gatspy commented Feb 18, 2022

@bomgar thanks, i will try it.

@bomgar bomgar closed this as completed Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants