Advertisement
Guest User

Untitled

a guest
Aug 14th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. # First config
  2. input {
  3. tcp {
  4. port => 5044
  5. type => json
  6. }
  7. }
  8. filter {
  9. json {
  10. source => "message"
  11. }
  12. }
  13.  
  14. output {
  15. stdout { codec => rubydebug }
  16. }
  17.  
  18. # Line I'm trying to parse
  19. {
  20. "logger_name" => "scrapy.core.scraper",
  21. "host" => "192.168.0.88",
  22. "stack_info" => nil,
  23. "type" => "logstash",
  24. "@timestamp" => 2019-08-14T15:38:40.011Z,
  25. "spider" => "<SiteSpider 'site-scraper' at 0x7f474bedc908>",
  26. "port" => 56576,
  27. "tags" => ,
  28. "@version" => "1",
  29. "level" => "DEBUG",
  30. "message" => "Scraped from <200 https://example.com/new_posts>\n{'link': 'https://example.com//3g67o/post/hjg78g78t',\n 'image': 'https://cdnthumb2.example.com/liuh89/ios.jpg'}",
  31. "path" => "/home/drake/virtualenv/newscrapy/lib/python3.6/site-packages/scrapy/core/scraper.py"
  32. }
  33.  
  34. #second filter
  35. filter {
  36. json {
  37. source => "message"
  38. }
  39. if "DEBUG" in [level] {
  40. grok {
  41. patterns_dir => ["/vagrant/patterns"]
  42. match => { "message" => "<%{CODE} %{URL}>\n%{JITEM}" }
  43. }
  44. }
  45. }
  46.  
  47. # My patterns_dir file
  48. CODE [0-9]{3}
  49. URL http[s]?://.*
  50. JITEM {.*}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement