내용으로 건너뛰기

How to get source IP address on the website when traffic come.

0

Hi Team,

I want to fetch the source IP address when any user hit the website . How can we get the client IP address when traffic or attack come on the website. Is there any simple way so we can configure this in cloud watch dashboard and we can see any time for any specific time.

We are using WAF and load balancer in our project.

Thanks, Anuj

2개 답변
1
수락된 답변

If you have ALB logging enabled you can obtain the client IP addresses from querying logs in the S3 bucket using Athena.

https://docs.aws.amazon.com/athena/latest/ug/application-load-balancer-logs.html

Similarly with WAF. https://docs.aws.amazon.com/athena/latest/ug/waf-logs.html

Or via cloud watch (WAF) https://repost.aws/knowledge-center/waf-analyze-logs-stored-cloudwatch-s3

전문가
답변함 2년 전
전문가
검토됨 2년 전
  • Hi Gary,

    Thanks for the response, I have enabled the alb logs but when I check the alb logs manually there are multiple internal AWS IP'S so I am unable to identify actual traffic on the website. Also we have logs in gzip folder type in S3 bucket so it's typical to check the logs.

  • Which column are you seeing AWS IPs? Usually that’s only the target_IP. You should be looking at client_ip

  • That’s why you need Athena. You can’t look at the logs file directly. Athena queries the gzip files as if they are a sql table.

  • There are no specific different in the file as client IP , Target ip. Just mention the ip only.

  • Please follow the link I provided. All will be clear when you use Athena.

0

If you are using ALB you'll find that the client source IP address is placed into the X-Forwarded-For header which you can retrieve when each request is processed. The documentation about this is here: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/x-forwarded-headers.html

As the other answer mentions: You can also retrieve the data from the ALB access logs so it depends on whether you want to know the IP address when the request comes in (use the headers above) or process that information historically.

You also have access to the client IP within WAF: https://repost.aws/knowledge-center/waf-mitigate-ddos-attacks

AWS
전문가
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠