Skip to content

Logstash: 8.10.2: Issues with fasterxml: Can not write a field name, expecting a value #15405

@rpasche

Description

@rpasche

Hello,

setting log.format: "json" throws lot of "com.fasterxml.j ackson.core.JsonGenerationException: Can not write a field name, expecting a value

steps to verify this issue with official docker image (8.10.2)

Create custom logstash.yml file and make sure, the log.format: "json" is set (this triggers the error).

# logstash.yml
log.format: "json"
http.host: "0.0.0.0"
pipeline.ecs_compatibility: "disabled"
#log.level: "debug"

create a custom pipeline configuration

# logstash.conf
input {
  http {
    port => "1080"
  }
}

filter {}

output {
  stdout {
    codec => rubydebug { metadata => true }
  }
}

Run logstash via

docker run --rm -it -v $(pwd)/logstash.yml:/usr/share/logstash/config/logstash.yml -v $(pwd)/logstash.conf:/usr/share/logstash/pipeline/logstash.conf logstash:8.10.2

You will directly see that error

/logstash_test$ docker run --rm -it -v $(pwd)/logstash.yml:/usr/share/logstash/config/logstash.yml -v $(pwd)/logstash_config.conf:/usr/share/logstash/pipeline/logstash.conf logstash:8.10.2
Using bundled JDK: /usr/share/logstash/jdk
Sending Logstash logs to /usr/share/logstash/logs which is now configured via log4j2.properties
{"level":"INFO","loggerName":"logstash.runner","timeMillis":1696853661724,"thread":"main","logEvent":{"message":"Log4j configuration path used is: /usr/share/logstash/config/log4j2.properties"}}
{"level":"INFO","loggerName":"logstash.runner","timeMillis":1696853661745,"thread":"main","logEvent":{"message":"Starting Logstash","logstash.version":"8.10.2","jruby.version":"jruby 9.4.2.0 (3.1.0) 2023-03-08 90d2913fda OpenJDK 64-Bit Server VM 17.0.8+7 on 17.0.8+7 +indy +jit [x86_64-linux]"}}
{"level":"INFO","loggerName":"logstash.runner","timeMillis":1696853661749,"thread":"main","logEvent":{"message":"JVM bootstrap flags: [-Xms1g, -Xmx1g, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djruby.compile.invokedynamic=true, -XX:+HeapDumpOnOutOfMemoryError, -Djava.security.egd=file:/dev/urandom, -Dlog4j2.isThreadContextMapInheritable=true, -Dls.cgroup.cpuacct.path.override=/, -Dls.cgroup.cpu.path.override=/, -Djruby.regexp.interruptible=true, -Djdk.io.File.enableADS=true, --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED, --add-opens=java.base/java.security=ALL-UNNAMED, --add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.nio.channels=ALL-UNNAMED, --add-opens=java.base/sun.nio.ch=ALL-UNNAMED, --add-opens=java.management/sun.management=ALL-UNNAMED]"}}
{"level":"INFO","loggerName":"logstash.settings","timeMillis":1696853661760,"thread":"main","logEvent":{"message":"Creating directory","setting":"path.queue","path":"/usr/share/logstash/data/queue"}}
{"level":"INFO","loggerName":"logstash.settings","timeMillis":1696853661762,"thread":"main","logEvent":{"message":"Creating directory","setting":"path.dead_letter_queue","path":"/usr/share/logstash/data/dead_letter_queue"}}
{"level":"INFO","loggerName":"logstash.agent","timeMillis":1696853661991,"thread":"LogStash::Runner","logEvent":{"message":"No persistent UUID file found. Generating new UUID","uuid":"92b8df7d-3942-43df-9ab3-b49cfcd52378","path":"/usr/share/logstash/data/uuid"}}
{"level":"INFO","loggerName":"logstash.agent","timeMillis":1696853662638,"thread":"Api Webserver","logEvent":{"message":"Successfully started Logstash API endpoint","port":9600,"ssl_enabled":false}}
{"level":"INFO","loggerName":"org.reflections.Reflections","timeMillis":1696853662850,"thread":"Converge PipelineAction::Create<main>","logEvent":{"message":"Reflections took 112 ms to scan 1 urls, producing 132 keys and 464 values"}}
{"level":"INFO","loggerName":"logstash.javapipeline","timeMillis":1696853663143,"thread":"Converge PipelineAction::Create<main>","logEvent":{"message":"Pipeline `main` is configured with `pipeline.ecs_compatibility: disabled` setting. All plugins in this pipeline will default to `ecs_compatibility => disabled` unless explicitly configured otherwise."}}
{"level":"INFO","loggerName":"logstash.javapipeline","timeMillis":1696853663179,"thread":"[main]-pipeline-manager","logEvent":{"message":"Starting pipeline","pipeline_id":"main","pipeline.workers":4,"pipeline.batch.size":125,"pipeline.batch.delay":50,"pipeline.max_inflight":500,"pipeline.sources":["/usr/share/logstash/pipeline/logstash.conf"],"thread":"#<Thread:0x164ef52e /usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:134 run>"}}
{"level":"INFO","loggerName":"logstash.javapipeline","timeMillis":1696853663742,"thread":"[main]-pipeline-manager","logEvent":{"message":"Pipeline Java execution initialization time","seconds":0.55}}
{"level":"INFO","loggerName":"logstash.javapipeline","timeMillis":1696853663888,"thread":"[main]-pipeline-manager","logEvent":{"message":"Pipeline started","pipeline.id":"main"}}
{"level":"INFO","loggerName":"logstash.inputs.http","timeMillis":1696853663893,"thread":"[main]<http","logEvent":{"message":"Starting http input listener","address":"0.0.0.0:1080","ssl":"false"}}
2023-10-09 12:14:24,100 Agent thread ERROR com.fasterxml.jackson.core.JsonGenerationException: Can not write a field name, expecting a value com.fasterxml.jackson.core.JsonGenerationException: Can not write a field name, expecting a value
    at com.fasterxml.jackson.core.JsonGenerator._reportError(JsonGenerator.java:2849)
    at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.writeFieldName(WriterBasedJsonGenerator.java:153)
...

See also official Elastic case: 01495152

Kind regards
Robert

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions