Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

Check if data is in squid native log format

Hi,
How to write a script to check a line from a file to confirm that the data in file is in squid native log file format.
Providing the followings:
1) data_file (sample data)
1086670800.875 79 192.168.7.144 TCP_MISS/200 21326 GET http://www.ato.gov.au/common/javascript/iemenus.js - DIRECT/www.ato.gov.au text/html

2) squid native file format:
http://www.squid-cache.org/Doc/FAQ/FAQ-6.html#ss6.6
 
Thx all,
0
jetli
Asked:
jetli
1 Solution
 
sneeuw_chanCommented:
Hmm, let's see.  You could use some kind of regex package, and compile a regular expression that accepts that squid format.

For example: grep -ve"^[0-9]*\.[0-9]* [0-9]* [^ ]* [^/]*/[0-9]* [0-9]* [^ ]* [^ ]*" <file> might work to show all lines that are not in this format.
(Assuming I parsed that correctly)

Of course, you could put in additional restrictions, if you know for sure for example that the URL is of the form <something>://<something> you could put that in.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now