Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. So, this is my output configuration:
  2.  
  3. > output
  4. > {
  5. >
  6. >
  7. >
  8. >
  9. > if [field] == "ABC" and [Properly_Formatted] == "Yes"
  10. > {
  11. > elasticsearch
  12. > {
  13. > hosts => "localhost:9200"
  14. > user => "xxx"
  15. > password => "xxx"
  16. > index => "abc"
  17. > }
  18. > }
  19. >
  20. > else if [field] == "DEF" and [Properly_Formatted] == "Yes"
  21. > {
  22. > elasticsearch
  23. > {
  24. > hosts => "localhost:9200"
  25. > user => "xxx"
  26. > password => "xxx"
  27. > index => "def"
  28. > }
  29. > }
  30. >
  31. > else
  32. > {
  33. > elasticsearch
  34. > {
  35. > hosts => "localhost:9200"
  36. > user => "xxx"
  37. > password => "xxx"
  38. > index => "other"
  39. > }
  40. > }
  41. >
  42. > stdout
  43. > {
  44. > codec => rubydebug
  45. > }
  46. > }
  47.  
  48.  
  49. Everything work good, if field exist it's throwing my logs to properly indices.
  50. But the error show up, when the field has another value than "abc" or "def".
  51. Output config say us that, for example: log with field with value "xyz" should go to index "other",
  52. but log didn't appear there, and in logstash stdout i can find error:
  53.  
  54. > "error"=>{"type"=>"mapper_parsing_exception",
  55. > "reason"=>"failed to parse [field]", "caused_by"=>{"type"=>"number_format_exception",
  56. > "reason"=>"For input string: \"xyz\""}}}}, :level=>:warn}
  57.  
  58. I'm pretty sure that, this error is related to output config.
  59. If statement didn't work properly?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement