Skip to content

Question on usage With Cratedb version 3.0.4 #2

Description

@raghu999

@buom @replay Hello Thank you for this Project , I am trying to use this Plugin to ship docker logs to cratedb and I am seeing the below pasted error. Can you help me understand what I am doing wrong.

Table:

CREATE TABLE fluentdtest2 (
  "time" Timestamp,
  "labweek-log" OBJECT(DYNAMIC),
  PRIMARY KEY ("time")
 ) with (number_of_replicas='0-all') ;

Fluentd-Config:

<source>
  @type forward
  port 24224
</source>

<match fluent.**>
  @type null
</match>

<filter>
  @type parser
  key_name log
  reserve_data true
  replace_invalid_sequence true
  hash_value_field fields
  remove_key_name_field true
  <parse>
    @type json
  </parse>
</filter>
  
<filter>
  @type record_transformer
  <record>
    index_name fluentdtest3
  </record>
</filter>
 
<match labweek-log>
  @type copy
  <store>
  @type cratedb
  host  cratedb.example.com
  port  4200
  column_names time,"labweek-log"
  table fluentdtest3
  flush_interval 10s
  </store>
  <store>
     @type stdout
  </store> 
</match>

<match **>
  @type stdout
</match>

Payload which is being inserted to Cratedb via plugin:

2018 - 07 - 29 17: 11: 35.157912763 + 0000 labweek - log: {
	"container_id":"b71c973f24c75b83a6b9f1bb5a52306d4b589c937202f6be37f21991a918f12f",
	"container_name": "/mesos-e5a54741-ddc5-4db0-976b-8c8566033948",
	"source": "stdout",
	"fields": {
		"@timestamp": "2018-07-29T17:11:35.153+00:00",
		"timestamp_iso": "2018-07-29T17:11:35.153+00:00",
		"env": "qa",
		"customContext": {
			"status-code": 404,
			"request-path": "/ping",
			"user-agent": "curl/7.54.0",
			"request-method": "HEAD"
		},
		"moneyTracingContext": {
			"startTime": 1532884295151,
			"appName": "labweek",
			"host": "b71c973f24c7",
			"spanName": "LJRequest",
			"spanId": 1786106802582332610,
			"spanSuccess": true,
			"duration-micros": 515,
			"traceId": "656fcb16-cca8-49e4-99bd-55f66a74625a",
			"parentId": 1786106802582332610
		},
		"LogContext": {
			"level": "INFO",
			"logger_name": "trace",
			"message": "spanEvent",
			"context": "default"
		},
		"ErrorContext": {},
		"ProcessContext": {
			"thread_name": "finagle/netty4-2"
		}
	},
	"index_name": "fluentdtest3"
}

Error Log in fluentd:

2018-07-29 17:04:29 +0000 [info]: #0 {"error":{"message":"SQLActionException[SQLParseException: Primary key value must not be NULL]","code":4000}}
2018-07-29 17:04:29 +0000 [warn]: #0 failed to flush the buffer. retry_time=0 next_retry_seconds=2018-07-29 17:04:30 +0000 chunk="5722655e9d95a685d6b5e11370eede29" error_class=CrateRuby::CrateError error="{\"error\":{\"message\":\"SQLActionException[SQLParseException: Primary key value must not be NULL]\",\"code\":4000}}"
  2018-07-29 17:04:29 +0000 [warn]: #0 /usr/local/bundle/gems/fluent-plugin-cratedb-0.2.0/lib/fluent/plugin/out_cratedb.rb:109:in `execute'
  2018-07-29 17:04:29 +0000 [warn]: #0 /usr/local/bundle/gems/fluent-plugin-cratedb-0.2.0/lib/fluent/plugin/out_cratedb.rb:64:in `write'
  2018-07-29 17:04:29 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.2.3/lib/fluent/compat/output.rb:131:in `write'
  2018-07-29 17:04:29 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.2.3/lib/fluent/plugin/output.rb:1099:in `try_flush'
  2018-07-29 17:04:29 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.2.3/lib/fluent/plugin/output.rb:1378:in `flush_thread_run'
  2018-07-29 17:04:29 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.2.3/lib/fluent/plugin/output.rb:440:in `block (2 levels) in start'
  2018-07-29 17:04:29 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.2.3/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
2018-07-29 17:04:30 +0000 [info]: #0 {"error":{"message":"SQLActionException[SQLParseException: Primary key value must not be NULL]","code":4000}}
2018-07-29 17:04:30 +0000 [warn]: #0 failed to flush the buffer. retry_time=0 next_retry_seconds=2018-07-29 17:04:30 +0000 chunk="5722655e9d95a685d6b5e11370eede29" error_class=CrateRuby::CrateError error="{\"error\":{\"message\":\"SQLActionException[SQLParseException: Primary key value must not be NULL]\",\"code\":4000}}"
  2018-07-29 17:04:30 +0000 [warn]: #0 suppressed same stacktrace
2018-07-29 17:04:32 +0000 [info]: #0 {"error":{"message":"SQLActionException[SQLParseException: Primary key value must not be NULL]","code":4000}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions