in reply to Sorting apache log files

I've got something worked out but I think it can be made better.

Better, in this case, might be to do nothing. Apache log files are already sorted by date/time.

Assuming that you picked a poor example, and are thinking about sorting in general, consider how big the logfiles will get, and whether you might be better off preprocessing them so that a stand-alone sort program (one that knows how to cope with things that can't fit into available virtual memory) can be employed.

Replies are listed 'Best First'.
Re: Re: Sorting apache log files
by diotalevi (Canon) on Sep 30, 2002 at 21:14 UTC

    Incidentally I was just thinking that if you really need to do your own sorting and you have issues with available memory you might consider checking out a Radix sort. The variation that saves you memory is when you write each slot (or perhaps a group of slots) out to an external file. If the partition is unsorted then just sort *that* and combine your partitions in order. Does anyone have a good reference on how a real person might implement Radix? I'd just refer back to Knuth's TAoCP vol2 but that's not for everyone.

Re: Re: Sorting apache log files
by ehdonhon (Curate) on Sep 30, 2002 at 22:45 UTC
    Better, in this case, might be to do nothing. Apache log files are already sorted by date/time.

    Not always. For example, one might choose to have different virtual hosts split out into different logs. rlb3 might simply be trying to concatenate different log files and then sort them. Not every person uses the same configuration, you know. :)