{"action":"created","issue":{"url":"https://api.github.com/repos/logstash-plugins/logstash-filter-math/issues/3","repository_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-math","labels_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-math/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-math/issues/3/comments","events_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-math/issues/3/events","html_url":"https://github.com/logstash-plugins/logstash-filter-math/issues/3","id":330597142,"node_id":"MDU6SXNzdWUzMzA1OTcxNDI=","number":3,"title":"Discuss: Syntax of calculation expression","user":{"login":"guyboertje","id":84912,"node_id":"MDQ6VXNlcjg0OTEy","avatar_url":"https://avatars2.githubusercontent.com/u/84912?v=4","gravatar_id":"","url":"https://api.github.com/users/guyboertje","html_url":"https://github.com/guyboertje","followers_url":"https://api.github.com/users/guyboertje/followers","following_url":"https://api.github.com/users/guyboertje/following{/other_user}","gists_url":"https://api.github.com/users/guyboertje/gists{/gist_id}","starred_url":"https://api.github.com/users/guyboertje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyboertje/subscriptions","organizations_url":"https://api.github.com/users/guyboertje/orgs","repos_url":"https://api.github.com/users/guyboertje/repos","events_url":"https://api.github.com/users/guyboertje/events{/privacy}","received_events_url":"https://api.github.com/users/guyboertje/received_events","type":"User","site_admin":false},"labels":[{"id":536888863,"node_id":"MDU6TGFiZWw1MzY4ODg4NjM=","url":"https://api.github.com/repos/logstash-plugins/logstash-filter-math/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":536888866,"node_id":"MDU6TGFiZWw1MzY4ODg4NjY=","url":"https://api.github.com/repos/logstash-plugins/logstash-filter-math/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-06-08T10:02:46Z","updated_at":"2018-06-11T12:35:41Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I am collecting opinions on the syntax of the expression.\r\nCurrent: `filter {  math { calculate => [ [ \"-\", \"[var1]\", \"[var2]\", \"[result]\" ] ] } }`\r\nProposals:\r\n1. `filter {  math { calculate => [ [ \"[result]\", \"[var1]\", \"-\", \"[var2]\" ] ] } }` \r\n  This switches the order to look more like written arithmetic.\r\n2. `filter {  math { calculate => [ \"[result] = [var1] - [var2]\" ] } }`\r\n  This defines the expression as one string which is parsed into arrays as above.\r\n3. `filter {  math { calculate => [ \"[result1] = %{[var1]} - %{[var2]}\", \"[result1] = %{[result1]} / 100\" ] } }`\r\n  This defines the expression as one string but uses interpolation and is parsed into arrays like the one above.\r\n\r\nCurrently the operands `[var1]` and `[var2]` must be fields but there is no reason why these can't be numeric values."},"comment":{"url":"https://api.github.com/repos/logstash-plugins/logstash-filter-math/issues/comments/396228155","html_url":"https://github.com/logstash-plugins/logstash-filter-math/issues/3#issuecomment-396228155","issue_url":"https://api.github.com/repos/logstash-plugins/logstash-filter-math/issues/3","id":396228155,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjIyODE1NQ==","user":{"login":"jsvd","id":31809,"node_id":"MDQ6VXNlcjMxODA5","avatar_url":"https://avatars3.githubusercontent.com/u/31809?v=4","gravatar_id":"","url":"https://api.github.com/users/jsvd","html_url":"https://github.com/jsvd","followers_url":"https://api.github.com/users/jsvd/followers","following_url":"https://api.github.com/users/jsvd/following{/other_user}","gists_url":"https://api.github.com/users/jsvd/gists{/gist_id}","starred_url":"https://api.github.com/users/jsvd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsvd/subscriptions","organizations_url":"https://api.github.com/users/jsvd/orgs","repos_url":"https://api.github.com/users/jsvd/repos","events_url":"https://api.github.com/users/jsvd/events{/privacy}","received_events_url":"https://api.github.com/users/jsvd/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T12:35:41Z","updated_at":"2018-06-11T12:35:41Z","author_association":"NONE","body":"To sum up my opinion:\r\n\r\n1. I think RPN is hard for a human to parse, it was made for computers to evaluate expressions with a stack.\r\n\r\n2. The infix notation w/ parenthesis support is the best if the plugin is going to support nested expressions and more complex math, e.g. `\"([field1]+[field2])*2-[field3]^2\"`. Humans are used to reading this.\r\n\r\n3. If we only support a single operation then I suggest the current prefix (polish) notation with an array and named operations. "}}
{"actor":{"display_login":"jsvd"}}