Logstash insert only first row

I am getting data from Google API and I want to save it to ES using logstash.

logstash conf file

input {
  file {
    path            => "/home/templetes/dt5.txt"
    start_position  => "beginning"
    sincedb_path    => "/dev/null"
    codec  => "json"        
  }
}

filter { 
  json {
    source  => "message"
  } 
}

output {
  stdout { codec => rubydebug }
  if [reviewId] != "" {
    elasticsearch {
      hosts => ["http://127.0.0.1:9200"] 
      index => "losscation_7"
      document_id => "%{reviewId}"
      template =>"/home/templetes/datamobi.json"
      template_name=>"datamobi"
      template_overwrite => true
    }
  }
}

datamobi.json (template) file

{
  "index_patterns": ["losscation*"],
  "settings": {
    "index": {
      "number_of_shards": "2",
      "number_of_replicas": "1"
    }
  },
  "mappings": {
    "doc":{
      "dynamic": "false"
    }
  },
  "aliases": {}
}

in my controller (PHP, Codeigniter), I am writing the file(dt5.txt) with data that I am getting from API. But the problem is it is inserting the first document only. But if I manually change the file(dt5.txt), it is inserting all data. What might be the issue?

Got my solution, i was using txt file. Now i am using JSON file ie dt5.json. Problem solved.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.