Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Check if data is in squid native log format

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 TCP_MISS/200 21326 GET - DIRECT/ text/html

2) squid native file format:
Thx all,
1 Solution
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.
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