ALB access logs request initiator domain

231 Views Asked by At

is there any way to retrieve the user client domain from the ALB access logs? from AWS documantation there is a 'domain_name' attribute but it is indicates the requested server domain rather than the client domain.

i know that in nginx there is a domain attribute which indicates the domain of the client, is there a way to retrieve client domain from the alb?.

1

There are 1 best solutions below

0
Marcin On

As you've pointed out, ALB access logs do not provide client's dns name. Instead they return:

  • client:port - The IP address and port of the requesting client.

Thus, to get the domain name of the client, you would have to parse the logs, and "manually" get the domain based on the IP. For example, if python is used, there is gethostbyaddr which can be useful in getting the domain name from an IP address.