Solved

Check if data is in squid native log format

Posted on 2004-09-02
3
203 Views
Last Modified: 2010-04-22
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
Comment
Question by:jetli
3 Comments
 
LVL 2

Accepted Solution

by:
sneeuw_chan earned 250 total points
ID: 11976393
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question