A while ago, I posted about the tgrep challenge. The tgrep challenge was to devise an application which can search through very large log files for lines which match the time (the name of the challenge will give away the purpose for those familiar with the grep tool). The challenge focuses specifically on HAProxy logs and the main behaviour of the application is that a user should be able to provide either a time or time range and optionally a log path (with a default) and have the lines within the scope of the log file returned.
I forgot to upload at the time my initial naive attempt at the challenge, so I thought I should upload it to github in all it’s first attempt naivete so others could critique the approach. Please note that this isn’t actually comparable to the original competition entries for two reasons:
- It’s written in Delphi and therefore runs only on windows (at this point)
- It’s not actually that quick (at the moment)
My initial implementation works and comes with tests to prove it but isn’t particularly quick. If anyone wishes to have a go at their own implementation, or fork it, the delphi tgrep repository is on github:
If anyone has any suggestions, please feel free to comment below or contact me on github.
Incidentally, this was also my first attempt at trying to use github for windows and I have to say that I found it very difficult to use compared to using git as-is on the command line because it seemed to commit not in the .gitignore everything automatically. This is a reason why there is a confusing commit history on that repo. Instead I had to update my .gitignore to work around this: