{"action":"created","issue":{"url":"https://api.github.com/repos/google/mtail/issues/217","repository_url":"https://api.github.com/repos/google/mtail","labels_url":"https://api.github.com/repos/google/mtail/issues/217/labels{/name}","comments_url":"https://api.github.com/repos/google/mtail/issues/217/comments","events_url":"https://api.github.com/repos/google/mtail/issues/217/events","html_url":"https://github.com/google/mtail/issues/217","id":419277019,"node_id":"MDU6SXNzdWU0MTkyNzcwMTk=","number":217,"title":"Optional/unordered fields in ligne?","user":{"login":"Xaelias","id":6390600,"node_id":"MDQ6VXNlcjYzOTA2MDA=","avatar_url":"https://avatars2.githubusercontent.com/u/6390600?v=4","gravatar_id":"","url":"https://api.github.com/users/Xaelias","html_url":"https://github.com/Xaelias","followers_url":"https://api.github.com/users/Xaelias/followers","following_url":"https://api.github.com/users/Xaelias/following{/other_user}","gists_url":"https://api.github.com/users/Xaelias/gists{/gist_id}","starred_url":"https://api.github.com/users/Xaelias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xaelias/subscriptions","organizations_url":"https://api.github.com/users/Xaelias/orgs","repos_url":"https://api.github.com/users/Xaelias/repos","events_url":"https://api.github.com/users/Xaelias/events{/privacy}","received_events_url":"https://api.github.com/users/Xaelias/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-03-11T03:14:09Z","updated_at":"2019-03-13T04:59:20Z","closed_at":null,"author_association":"NONE","body":"Hi (me again, sorry, promise it's the last question :-D )\r\nI'm trying to match something, and I wanted to have bit of freedom while doing so.\r\nThat is that given a list of fields definition, these fields may or may not be in the line currently being parsed, and they may be in a random order.\r\nI couldn't find a way to do this with the regular syntax. And then I went into decorators, but it looks like if a decorator isn't matched, then the whole thing \"fails\".\r\nIs there a way to work around that? Or give a default value to things that don't exist?\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/google/mtail/issues/comments/472280245","html_url":"https://github.com/google/mtail/issues/217#issuecomment-472280245","issue_url":"https://api.github.com/repos/google/mtail/issues/217","id":472280245,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3MjI4MDI0NQ==","user":{"login":"jaqx0r","id":3038203,"node_id":"MDQ6VXNlcjMwMzgyMDM=","avatar_url":"https://avatars3.githubusercontent.com/u/3038203?v=4","gravatar_id":"","url":"https://api.github.com/users/jaqx0r","html_url":"https://github.com/jaqx0r","followers_url":"https://api.github.com/users/jaqx0r/followers","following_url":"https://api.github.com/users/jaqx0r/following{/other_user}","gists_url":"https://api.github.com/users/jaqx0r/gists{/gist_id}","starred_url":"https://api.github.com/users/jaqx0r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaqx0r/subscriptions","organizations_url":"https://api.github.com/users/jaqx0r/orgs","repos_url":"https://api.github.com/users/jaqx0r/repos","events_url":"https://api.github.com/users/jaqx0r/events{/privacy}","received_events_url":"https://api.github.com/users/jaqx0r/received_events","type":"User","site_admin":false},"created_at":"2019-03-13T04:59:20Z","updated_at":"2019-03-13T04:59:20Z","author_association":"CONTRIBUTOR","body":"Currently the only way to do this is to specify multiple different match patterns at the same level in your program; each will be attempted and the ones that match will have their blocks executed.\r\n\r\nSo as long as you have a fragment of the regex you can put them all next to each other.\r\n\r\n```\r\nhidden text a\r\nhidden text b\r\n/a=(\\s+)/ {\r\n  a=$1\r\n}\r\n/b=(\\s+)/ {\r\n  b=$1\r\n}\r\n```\r\nYou can then refer to the values of `a` and `b` later on:\r\n```\r\ncounter foo by a,b\r\n\r\n{\r\nfoo[a][b] ++\r\n}\r\n```\r\n\r\nThis works if you have something you can trigger on when you know you have all the information.\r\n\r\nThe https://github.com/google/mtail/blob/master/examples/mysql_slowqueries.mtail program demonstrates how to fetch partial information from a multiline dump, and then turn it into a metric, e.g from this sort of log:\r\n\r\nhttps://github.com/google/mtail/blob/master/internal/mtail/testdata/mysql_slowqueries.log"}}
{"actor":{"display_login":"jaqx0r"}}