I am logging all incoming and outgoing IP connections and ports to my Linux server with IPtables LOG. Now, I wish to log the services to which these IPs connects in server.
Example, if the connection is to port 80, then log service name as httpd. Is it possible with IPtables logging? Below is the rules I am using right now.:
-A INPUT -j LOG --log-prefix "IPs INCOMING"
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -s x.x.x.x/8 -j ACCEPT
-A INPUT -s x.x.x.x/12 -j ACCEPT
-A INPUT -s x.x.x.x/16 -j ACCEPT
-A OUTPUT -j LOG --log-prefix "IPs OUTGOING"