The tricky part about dns.answers
is that it is an array of objects (see raw event below). You can run queries on it, like dns.answers.data:"66.218.75.97"
, but it will be difficult to create visualizations.
My sample event was indexed directly into Elasticsearch from Packetbeat and I am using the default index template provided by Packetbeat 5.x. You can route the data through Logstash as you are doing but it would be best if you used the index template provided by your Packetbeat version to ensure the mappings are correct. See the section on loading the index template and see the section about configuring Logstash for Beats to make sure you are using the template.
{
"@timestamp": "2016-06-20T22:45:38.084Z",
"beat": {
"hostname": "xx",
"name": "xx"
},
"bytes_in": 37,
"bytes_out": 506,
"client_ip": "xx",
"client_port": 52897,
"client_proc": "",
"client_server": "",
"count": 1,
"dns": {
"additionals_count": 5,
"answers": [
{
"class": "IN",
"data": "imap.mail.gm0.yahoodns.net.",
"name": "imap.mail.yahoo.com.",
"ttl": "279",
"type": "CNAME"
},
{
"class": "IN",
"data": "67.195.236.149",
"name": "imap.mail.gm0.yahoodns.net.",
"ttl": "8",
"type": "A"
},
{
"class": "IN",
"data": "66.218.75.97",
"name": "imap.mail.gm0.yahoodns.net.",
"ttl": "8",
"type": "A"
},
{
"class": "IN",
"data": "98.138.74.45",
"name": "imap.mail.gm0.yahoodns.net.",
"ttl": "8",
"type": "A"
},
{
"class": "IN",
"data": "98.138.74.44",
"name": "imap.mail.gm0.yahoodns.net.",
"ttl": "8",
"type": "A"
},
{
"class": "IN",
"data": "98.138.74.42",
"name": "imap.mail.gm0.yahoodns.net.",
"ttl": "8",
"type": "A"
},
{
"class": "IN",
"data": "67.195.236.145",
"name": "imap.mail.gm0.yahoodns.net.",
"ttl": "8",
"type": "A"
},
{
"class": "IN",
"data": "67.195.236.146",
"name": "imap.mail.gm0.yahoodns.net.",
"ttl": "8",
"type": "A"
},
{
"class": "IN",
"data": "66.218.74.148",
"name": "imap.mail.gm0.yahoodns.net.",
"ttl": "8",
"type": "A"
}
],
"answers_count": 9,
"authorities_count": 13,
"flags": {
"authentic_data": false,
"authoritative": false,
"checking_disabled": false,
"recursion_available": true,
"recursion_desired": true,
"truncated_response": false
},
"id": 33912,
"op_code": "QUERY",
"question": {
"class": "IN",
"etld_plus_one": "yahoo.com.",
"name": "imap.mail.yahoo.com.",
"type": "A"
},
"response_code": "NOERROR"
},
"ip": "xx",
"method": "QUERY",
"port": 53,
"proc": "",
"query": "class IN, type A, imap.mail.yahoo.com.",
"resource": "imap.mail.yahoo.com.",
"responsetime": 39,
"server": "",
"status": "OK",
"tags": [
"xx"
],
"transport": "udp",
"type": "dns"
}