kassner / log-parser

PHP Web Server Log Parser Library
Apache License 2.0
339 stars 64 forks source link

Support ipv6 addresses in logs #15

Closed Sophist-UK closed 9 years ago

Sophist-UK commented 9 years ago

This fix simplifies the ipv4 regex and adds support for recognising ipv6 addresses in log files for %a and %A.

Note: In the interests of simplicity we assume that ipv6 addresses in log files will be valid, and the ipv6 regex does will recognise all valid ipv6 addresses but will also pass some invalid ipv6 addresses i.e. 1:1:1:1:1:1:1::1:1:1:1:1:1:1 will pass.

Sophist-UK commented 9 years ago

Any news on this PR? My ISP supports ipv6 connections to my web site, so this plugin needs to handle IPv6 addresses in the server logs.

Sophist-UK commented 9 years ago

Neither merged nor commented on.

Any news?

kassner commented 9 years ago

Hi @Sophist-UK

Sorry for the long delay. I was hoping to add some tests to IPv6 addresses, but it seems very difficult to find a good regex that does not fail in some edge cases.

If you (or anyone reading here) is interested in contributing with IPv6 tests, there is a good list of valid and invalid IPv6 addresses to take a look on.

Thanks!

Sophist-UK commented 9 years ago

The regex used was the result of reasonably extensive internet research.

However, for the purposes of log parsing, it is probably not essential for the regex to identify edge cases.

Sophist-UK commented 9 years ago

P.S. Apologies - but I realise that I have not added any automated tests.