What you want is to use the http
protocol decoder in packetbeat. It is enabled by default. You should extended it with two extra options, send_headers
and send_all_headers
:
- type: http
# Configure the ports where to listen for HTTP traffic. You can disable
# the HTTP protocol by commenting out the list of ports.
ports: [80, 8080, 8000, 5000, 8002]
send_headers: true
send_all_headers: true
This will provide you with events like this:
{
"@timestamp": "2018-02-02T09:36:19.757Z",
"responsetime": 95,
"type": "http",
"bytes_in": 708,
"bytes_out": 33861,
"client_port": 54386,
"path": "/",
"direction": "out",
"port": 80,
"method": "GET",
"query": "GET /",
"http": {
"request": {
"params": "",
"headers": {
"host": "example.com",
"accept-encoding": "gzip, deflate",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6)",
"content-length": 0
}
},
"response": {
"headers": {
"connection": "Keep-Alive",
"server": "Apache/2.2.17",
"content-length": 33376,
"content-type": "text/html",
"expires": "Thu, 01 Jan 1980 0:00:00 GMT"
},
"code": 200,
"phrase": "OK"
}
},
"proc": "",
"status": "OK",
"client_ip": "192.168.1.39",
"ip": "62.99.163.135"
}
Now in Kibana you can build a nice visualisation using the fields in the http events. The fields you want are:
-
http.request.header.host: The server name part of the url ("www.hostnamenow.com")
-
path: The path component of the URL.
-
client_ip: The IP address of the client
-
bytes_in: Amount of data sent from client to server.
-
bytes_out: Amount of data sent from server to client.
If you're not familiar with visualisations, what you can do first is a table visualisation, then you can experiment with other types.
- first add a filter
type:"http"
so that only http events get used.
- change the default Metric type from
count
to sum
, to sand use the field bytes_out
, as what you ultimately want is to sum all bytes sent.
- add a new Metric of type
sum
for the bytes_in
field.
- Now you need to start adding buckets and sub-buckets to create aggregations. Use the
Terms
aggregation, first on the http.request.headers.host
field. Then add a sub-bucket using the client_ip
field.
This will give you a table similar to the one I showed you in a previous message.
Kibana visualisations are very powerful but they require practice to understand how the work. Have a look at the Kibana user guide.