Skip to content

Instantly share code, notes, and snippets.

@kroepke
Created April 22, 2016 08:59
Show Gist options
  • Save kroepke/27de3bfa2123c5b9ef091888068526cb to your computer and use it in GitHub Desktop.
Save kroepke/27de3bfa2123c5b9ef091888068526cb to your computer and use it in GitHub Desktop.
rule "static mapping"
when has_field("status_code")
then
let mapping = {`404`: "not found", `500`: "server error"};
set_field("status_code", mapping[to_string($message.status_code)]);
end
@rfdrake
Copy link

rfdrake commented Jul 20, 2016

How fast is this if you have a giant mapping? I'd like to translate something like https://www.linkedin.com/pulse/cisco-syslog-logstash-daniel-gilbertson-5994871489260695552 into this, but it may be a situation where it's better to standup a logstash server just to mangle things and send them to graylog via GELF.

@kroepke
Copy link
Author

kroepke commented Jul 26, 2016

@rfdrake It's really not fast, because the map will be recreated all the time. We have an open task to implement proper lookup tables, which is one of the remaining items to declare the pipelines non-experimental.

@kroepke
Copy link
Author

kroepke commented Jul 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment