Facebook
From Mature Hog, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 213
  1. Logstash.conf
  2.  
  3. input {
  4.         http{ }
  5. }
  6.  
  7. filter {
  8.         elasticsearch {
  9.           hosts => ["127.0.0.1:9200"]
  10.           index => "logstash-*"
  11.           query_template => "search-by-ip.json"
  12.           fields => {
  13.                   "id"  => "[suscriberid]"
  14.           }
  15.         }
  16.   }
  17.  
  18.  
  19. output {
  20.   stdout { codec => rubydebug }
  21. }
  22.  
  23. -----------------
  24. search-by-ip.json
  25.  
  26. {
  27.   "size": 1,
  28.   "query": { "match":{"IP": %{[ip]} } }
  29. }
  30. -------------------
  31. testcase.sh
  32.  
  33. curl -XPOST "localhost:8080" -H "Content-Type: application/json" -d '{
  34.   "size": 1,
  35.   "query": { "match":{"ip": "192.168.1.4" }}
  36. }'
  37.  
  38.