My understanding; ip adresses are considered personal information. You are allowed to store them in your log for security purposes, without consent (legitimate interest). But if you use that log for analytics, you need consent.
The case for legitimate interest in parsing logs is extremely weak. There are situations where you could claim it but it still must be with a clear purpose. E.g. a Spanish company considering opening a branch in France might collect IPs to make a heatmap of where its French customers are. But they would not be able to use those IPs generally, to the extent e.g. they might be expected to delete the IP and only store aggregated by department.
You also said PII, not PD - note that some PII is sensitive data, which cannot be collected under LI provisions at all.
(This is not legal advice. If you think you can collect personal data with the LI exception, godspeed and I hope you have a good lawyer.)