Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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