CNIL disagrees and says you can need them to secure your service. Legitimate interest (art. 6(1)f) is applicable (recital 49). You can also be required by law to keep them for some time, so legal requirement is applicable (art. 6(1)c). Other uses may require consent.
Cf: https://www.cnil.fr/sites/default/files/atoms/files/recomman... (in French, though)