{\"name\":\"int\",\"type\": \"int\"}"
The "name" of the field is "int" This is utterly confusing to someone trying to understand and grok what is going on. In the blog example, things are bit better, but still have challenges:"value_schema": "{\"type\": \"record\", \"name\": \"User\", \"fields\": [{\"name\": \"name\", \"type\": \"string\"}]}", "records": [ {"value": {"name": "testUser"}}, {"value": {"name": "testUser2"}}
However the name here is "name" once again, not helpful.
Additionally, I am at this point unclear on the concept of a "value_schema" vs a "key_schema", and when I should use each, or does it matter?, I am also confused on how to format requests where I have all my data ready to go, I have my schema registered, and I am stumped on how to proceed with multiple records. In this case, I am using the BroIDS connection log as a test case, I have the schema I registered below. At this point, my questions are:1. Is this a key_schema or a value_schema? Is there documentation to help me understand that (I am noob in this space)2. How do I format requests in my requests with multiple fields(the examples, as I have said, are confusing to me as I am not sure what are key or value names vs. keywords required for my records, and most seem to be only one value in the schema)3. Can I have a schema like this and not include a value? Bro has the concept of "unset" fields, the difference if say a useragent header doesn't exist in a request vs if it were to be set to blank string ("") Do I pass a "NULL" if a field is unset? How do Avro handle that? Do I just not include it?4. If there is a page with some other examples, I would really appreciate it. I am not trying to be negative, just pointing out my confusion as a "new" user to this space in trying to become a more experienced user :)Thank you!JohnBro ID Schema:
{ "schema": "{\"type\": \"record\", \"name\": \"bro_default_conn\", \"fields\": [{\"name\": \"ts\", \"type\": \"double\", \"doc\": \"Default Bro Schema parse for ts\"}, {\"name\": \"uid\", \"type\": \"string\", \"doc\": \"Default Bro Schema parse for uid\"}, {\"name\": \"id_orig_h\", \"type\": \"string\", \"doc\": \"Default Bro Schema parse for id.orig_h\"}, {\"name\": \"id_orig_p\", \"type\": \"int\", \"doc\": \"Default Bro Schema parse for id.orig_p\"}, {\"name\": \"id_resp_h\", \"type\": \"string\", \"doc\": \"Default Bro Schema parse for id.resp_h\"}, {\"name\": \"id_resp_p\", \"type\": \"int\", \"doc\": \"Default Bro Schema parse for id.resp_p\"}, {\"name\": \"proto\", \"type\": \"string\", \"doc\": \"Default Bro Schema parse for proto\"}, {\"name\": \"service\", \"type\": \"string\", \"doc\": \"Default Bro Schema parse for service\"}, {\"name\": \"duration\", \"type\": \"string\", \"doc\": \"Default Bro Schema parse for duration\"}, {\"name\": \"orig_bytes\", \"type\": \"long\", \"doc\": \"Default Bro Schema parse for orig_bytes\"}, {\"name\": \"resp_bytes\", \"type\": \"long\", \"doc\": \"Default Bro Schema parse for resp_bytes\"}, {\"name\": \"conn_state\", \"type\": \"string\", \"doc\": \"Default Bro Schema parse for conn_state\"}, {\"name\": \"local_orig\", \"type\": \"boolean\", \"doc\": \"Default Bro Schema parse for local_orig\"}, {\"name\": \"missed_bytes\", \"type\": \"long\", \"doc\": \"Default Bro Schema parse for missed_bytes\"}, {\"name\": \"history\", \"type\": \"string\", \"doc\": \"Default Bro Schema parse for history\"}, {\"name\": \"orig_pkts\", \"type\": \"long\", \"doc\": \"Default Bro Schema parse for orig_pkts\"}, {\"name\": \"orig_ip_bytes\", \"type\": \"long\", \"doc\": \"Default Bro Schema parse for orig_ip_bytes\"}, {\"name\": \"resp_pkts\", \"type\": \"long\", \"doc\": \"Default Bro Schema parse for resp_pkts\"}, {\"name\": \"resp_ip_bytes\", \"type\": \"long\", \"doc\": \"Default Bro Schema parse for resp_ip_bytes\"}, {\"name\": \"tunnel_parents\", \"type\": \"string\", \"doc\": \"Default Bro Schema parse for tunnel_parents\"}]}" }
POST /topics/test HTTP/1.1 Host: kafkaproxy.example.com Content-Type: application/vnd.kafka.avro.v1+json Accept: application/vnd.kafka.v1+json, application/vnd.kafka+json, application/json { "value_schema": "{\"name\":\"int\",\"type\": \"int\"}" "records": [ { "value": 12 }, { "value": 24, "partition": 1 } ] }
Example from Blog (http://blog.confluent.io/2015/03/25/a-comprehensive-open-source-rest-proxy-for-kafka/)
curl -i -X POST -H "Content-Type: application/vnd.kafka.avro.v1+json"
--data '{
"value_schema": "{\"type\": \"record\", \"name\": \"User\", \"fields\": [{\"name\": \"name\", \"type\": \"string\"}]}",
"records": [
{"value": {"name": "testUser"}},
{"value": {"name": "testUser2"}}
]
}' \
http://localhost:8082/topics/avrotest
I am working to understand the platform better, and am a bit disappointed with some Kafka Rest API examples provided. Basically, as someone new to this, I feel the examples are not well understand on what is "what". This is what I mean. In the API docs example (below) from what I can tell the schema is:{\"name\":\"int\",\"type\": \"int\"}"
The "name" of the field is "int" This is utterly confusing to someone trying to understand and grok what is going on. In the blog example, things are bit better, but still have challenges:"value_schema": "{\"type\": \"record\", \"name\": \"User\", \"fields\": [{\"name\": \"name\", \"type\": \"string\"}]}", "records": [ {"value": {"name": "testUser"}}, {"value": {"name": "testUser2"}}
However the name here is "name" once again, not helpful.
Additionally, I am at this point unclear on the concept of a "value_schema" vs a "key_schema", and when I should use each, or does it matter?, I am also confused on how to format requests where I have all my data ready to go, I have my schema registered, and I am stumped on how to proceed with multiple records. In this case, I am using the BroIDS connection log as a test case, I have the schema I registered below. At this point, my questions are:1. Is this a key_schema or a value_schema? Is there documentation to help me understand that (I am noob in this space)
2. How do I format requests in my requests with multiple fields(the examples, as I have said, are confusing to me as I am not sure what are key or value names vs. keywords required for my records, and most seem to be only one value in the schema)
{ "value_schema": "{\"type\": \"record\", \"name\": \"bro_default_conn\","{\"name\":\"int\",\"type\": \"int\"}" .... }", "records": [ RECORDS ] }
3. Can I have a schema like this and not include a value? Bro has the concept of "unset" fields, the difference if say a useragent header doesn't exist in a request vs if it were to be set to blank string ("") Do I pass a "NULL" if a field is unset? How do Avro handle that? Do I just not include it?
4. If there is a page with some other examples, I would really appreciate it. I am not trying to be negative, just pointing out my confusion as a "new" user to this space in trying to become a more experienced user :)
--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platf...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/3c0efa96-10ba-41fd-b09d-e976b984075a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Responses inline.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsub...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/3c0efa96-10ba-41fd-b09d-e976b984075a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Thanks,
Ewen
HTTP/1.1 422
Content-Length: 31
Content-Type: application/json
Server: Jetty(8.1.16.v20140903)
{"error_code":422,"message":""}
{
"value_schema_id": 101,
"records": [
{
"ts": "1431637257.883239",
"uid": "CJEy5h20lBY6V5QAI3",
"id_orig_h": "192.168.225.103",
"id_orig_p": "2148",
"id_resp_h": "192.168.100.40",
"id_resp_p": "20050",
"proto": "tcp",
"service": "NULL",
"duration": "NULL",
"orig_bytes": "NULL",
"resp_bytes": "NULL",
"conn_state": "S0",
"local_orig": "NULL",
"missed_bytes": "0",
"history": "S",
"orig_pkts": "1",
"orig_ip_bytes": "48",
"resp_pkts": "0",
"resp_ip_bytes": "0",
"tunnel_parents": "NULL"
}
]
}
Responses inline.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platf...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/3c0efa96-10ba-41fd-b09d-e976b984075a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Thanks,
Ewen--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/7b97176e-b899-432a-850c-e0e65e034767%40googlegroups.com.
POST /topics/brocon HTTP/1.1
Host: kafka-rest.marathon.mesos:8192
Content-Length: 622
User-Agent: python-requests/2.7.0 CPython/2.7.3 Linux/3.13.0-30-generic
Connection: keep-alive
Accept: application/vnd.schemaregistry.v1+json, application/vnd.schemaregistry+json, application/json
Accept-Encoding: gzip, deflate
{"value_schema_id": 105, "records": [{"ts": {"string": "1431637257.883239"}, "uid": {"string": "CJEy5h20lBY6V5QAI3"}, "id_orig_h": {"string": "192.168.225.103"}, "id_orig_p": {"int": 2148}, "id_resp_h": {"string": "192.168.2.2"}, "id_resp_p": {"int": 20050}, "proto": {"string": "tcp"}, "service": "null", "duration": "null", "orig_bytes": "null", "resp_bytes": "null", "conn_state": {"string": "S0"}, "local_orig": "null", "missed_bytes": {"long": 0}, "history": {"string": "S"}, "orig_pkts": {"long": 1}, "orig_ip_bytes": {"long": 48}, "resp_pkts": {"long": 0}, "resp_ip_bytes": {"long": 0}, "tunnel_parents": "null"}]}
{
"fields": [
{
"default": "null",
"doc": "Default Bro Schema parse for ts",
"type": [
"null",
"string"
],
"name": "ts"
},
{
"default": "null",
"doc": "Default Bro Schema parse for uid",
"type": [
"null",
"string"
],
"name": "uid"
},
{
"default": "null",
"doc": "Default Bro Schema parse for id.orig_h",
"type": [
"null",
"string"
],
"name": "id_orig_h"
},
{
"default": "null",
"doc": "Default Bro Schema parse for id.orig_p",
"type": [
"null",
"int"
],
"name": "id_orig_p"
},
{
"default": "null",
"doc": "Default Bro Schema parse for id.resp_h",
"type": [
"null",
"string"
],
"name": "id_resp_h"
},
{
"default": "null",
"doc": "Default Bro Schema parse for id.resp_p",
"type": [
"null",
"int"
],
"name": "id_resp_p"
},
{
"default": "null",
"doc": "Default Bro Schema parse for proto",
"type": [
"null",
"string"
],
"name": "proto"
},
{
"default": "null",
"doc": "Default Bro Schema parse for service",
"type": [
"null",
"string"
],
"name": "service"
},
{
"default": "null",
"doc": "Default Bro Schema parse for duration",
"type": [
"null",
"string"
],
"name": "duration"
},
{
"default": "null",
"doc": "Default Bro Schema parse for orig_bytes",
"type": [
"null",
"long"
],
"name": "orig_bytes"
},
{
"default": "null",
"doc": "Default Bro Schema parse for resp_bytes",
"type": [
"null",
"long"
],
"name": "resp_bytes"
},
{
"default": "null",
"doc": "Default Bro Schema parse for conn_state",
"type": [
"null",
"string"
],
"name": "conn_state"
},
{
"default": "null",
"doc": "Default Bro Schema parse for local_orig",
"type": [
"null",
"boolean"
],
"name": "local_orig"
},
{
"default": "null",
"doc": "Default Bro Schema parse for missed_bytes",
"type": [
"null",
"long"
],
"name": "missed_bytes"
},
{
"default": "null",
"doc": "Default Bro Schema parse for history",
"type": [
"null",
"string"
],
"name": "history"
},
{
"default": "null",
"doc": "Default Bro Schema parse for orig_pkts",
"type": [
"null",
"long"
],
"name": "orig_pkts"
},
{
"default": "null",
"doc": "Default Bro Schema parse for orig_ip_bytes",
"type": [
"null",
"long"
],
"name": "orig_ip_bytes"
},
{
"default": "null",
"doc": "Default Bro Schema parse for resp_pkts",
"type": [
"null",
"long"
],
"name": "resp_pkts"
},
{
"default": "null",
"doc": "Default Bro Schema parse for resp_ip_bytes",
"type": [
"null",
"long"
],
"name": "resp_ip_bytes"
},
{
"default": "null",
"doc": "Default Bro Schema parse for tunnel_parents",
"type": [
"null",
"string"
],
"name": "tunnel_parents"
}
],
"type": "record",
"name": "brocon"
}
Data attempted to post:
{
"value_schema_id": 105,
"records": [
{
"ts": {
"string": "1431637257.883239"
},
"uid": {
"string": "CJEy5h20lBY6V5QAI3"
},
"id_orig_h": {
"string": "192.168.225.103"
},
"id_orig_p": {
"int": 2148
},
"id_resp_h": {
"string": "192.168.2.2"
},
"id_resp_p": {
"int": 20050
},
"proto": {
"string": "tcp"
},
"service": "null",
"duration": "null",
"orig_bytes": "null",
"resp_bytes": "null",
"conn_state": {
"string": "S0"
},
"local_orig": "null",
"missed_bytes": {
"long": 0
},
"history": {
"string": "S"
},
"orig_pkts": {
"long": 1
},
"orig_ip_bytes": {
"long": 48
},
"resp_pkts": {
"long": 0
},
"resp_ip_bytes": {
"long": 0
},
"tunnel_parents": "null"
}
]
Responses inline.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsub...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/3c0efa96-10ba-41fd-b09d-e976b984075a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Thanks,
Ewen
--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/7b97176e-b899-432a-850c-e0e65e034767%40googlegroups.com.
--Thanks,
Ewen
Responses inline.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platf...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/3c0efa96-10ba-41fd-b09d-e976b984075a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Thanks,
Ewen
--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/7b97176e-b899-432a-850c-e0e65e034767%40googlegroups.com.
--
--Thanks,
Ewen
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platf...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/325f452c-cf14-4e24-8996-6961af71a703%40googlegroups.com.
{
"value_schema_id": 121,
{
"fields": [
{
"default": null,
"name": "brocon1"
}
...
--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platf...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/1e772d09-6ed9-499b-88c8-6a4cef8f1cae%40googlegroups.com.
John,Your latest format looks correct. Could you try simplifying the schema to see which field is causing the problem?Thanks,Jun
On Tue, May 26, 2015 at 7:12 AM, John Omernik <jo...@omernik.com> wrote:
I cleared all the previous messages to save space for folks. I was able to create an avrofile with avrotools using the schema I am trying to use, and the data I am trying to post, but I am still getting a 422 error back from Kafka rest. Where I can I look next for troubleshooting?Thanks!John
--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsub...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.