Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json_lines codec is still not working with file input plugin #40

Open
shashank-gupta017 opened this issue Mar 5, 2020 · 1 comment
Open
Labels

Comments

@shashank-gupta017
Copy link

shashank-gupta017 commented Mar 5, 2020

The json_lines codec when used on the file input plugin causes the file input plugin to not process any data.

input {
  file {
    path => ["/usr/local/Cellar/logstash/7.3.0/bin/grant.log"]
    exclude => ["*.gz"]
    sincedb_path => "/usr/local/Cellar/logstash/7.3.0/bin/grant.sincedb"
    start_position => "beginning"
    codec => "json_lines"
  }
}

output {
  stdout {
      codec => rubydebug
    }
}

When I replace the codec json_lines with json, the codec works and I get the parsed json. But with json_lines, no data is printed on stdout. I read the forums that json_lines should work with file input now, but in this case, it is still giving issues.

I also verified that in the input file, each json is de-limited with a \n by running the command cat input.log|od -tx1c

The sample input looks like this

{"group_id":153,"reason_id":357,"insert_time":"2020-03-04 13:58:48.000","fix_flag":0,"std_change":100,"type":"standard","transaction_id":"01538b8d-c580-3974-b41e-b2b0fb3fc856","timestamp":"2020-03-04 13:58:48.000","refkey":"keya1","transaction_status":"NEW","easy_id":12346738,"subkey":"subkeya1","points":100}
@yaauie
Copy link
Contributor

yaauie commented Aug 31, 2020

This is, somewhat unfortunately, by design.

The File input chunks its input by the delimiter, and hands the bytes between delimiters to the codec. This means that when it is configured with the json_lines codec, the codec never receives the delimiter and continues to add these chunks to its internal buffer instead of turning each chunk into a single event.

The solution is to use codec => json.

@kares kares added the wontfix label Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants