I wanted to write a script for expanding my Python knowledge. I ussually create small scripts to accommodate my “problems” or wishes.

If you want use it:

import socket

FQDN = []
ACC = []

ACC_FILE = open('/var/log/nginx/access.log')
for LINE in ACC_FILE:
        ACC.append(LINE.split(' ')[0])

ACC.sort()
ACC = set(ACC)
for LINE in ACC:
        ADDR = socket.getfqdn(LINE)
        FQDN.append(ADDR)

FQDN.sort()
for SERVER in FQDN:
        print(SERVER)