Page 1 of 1 1
Topic Options
#98572 - 2003-02-20 12:03 AM open, readline, close
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Every day we check our proxylog for visited sites.

We do not have a SQL database, so we use open, readline and close it works fine.

my question is, is there a better way (without SQL)??

GR Peter

Top
#98573 - 2003-02-20 12:11 AM Re: open, readline, close
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
depending of the log.
I never can think sql better than simple files.
difference comes when you need to manage the database...

anyway, what you need to crap from the log that is hard with readline?
_________________________
!

download KiXnet

Top
#98574 - 2003-02-20 12:59 AM Re: open, readline, close
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Jooel

Our script is running perfect.

But have read something about memmory usage with open() and large files.

Our isa proxylog is about 100 Mb every day and i am scanning this file for some URL s from a blacklist.

Than i filter the usernames and put these users in a group without internet rights.

GR Peter

Top
#98575 - 2003-02-19 01:14 PM Re: open, readline, close
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Peter,

How is the file constructed???
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#98576 - 2003-02-19 01:23 PM Re: open, readline, close
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Patrick,

Its a textfile, and every line is tab seperated.

Can mail you a part of the file if you are interested.

GR Peter

Top
#98577 - 2003-02-19 01:32 PM Re: open, readline, close
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
To reduce the workload, use a command line utility to filter the log file before you read it in KiXtart.

Get hold of a Windows native version of "grep". This is a powerful pattern matching utility, and you can construct queries like:
code:
grep "www.bannedsite.url|anotherbannedsite.com|yetanotherbannedsite.com" PROXYLOG.TXT > FILTEREDLOG.TXT

I use "grep" a lot for extracting information from my proxy log files, looking for banned sites and suspect words. It is also useful for removing unwanted hits. For example, suppose I wanted to look for all occurences of the words "sex", "porn" and "xxx", but I was not interested in URLs which have the UK counties Sussex and Essex in them:
code:
grep -i "sex|porn|xxx" PROXYLOG.TXT | grep -i -v "essex|sussex" > FILTEREDLOG.TXT

The "-i" makes the search case insensitive, the "-v" means "lines which don't match"

There are many places to get hold of grep compiled for Windows - here is one site which has this and many other *nix tools:
GnuWin32

Top
#98578 - 2003-02-19 01:38 PM Re: open, readline, close
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
I think Richard hit it right on the....

Peter, give Grep a try and let us know the results.
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#98579 - 2003-02-19 02:00 PM Re: open, readline, close
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Not to say anthing bad about KiXtart, but sometimes other tools could be more efficient and flexible.

Maybe you should investigate: perl - Practical Extraction and Report Language
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#98580 - 2003-02-19 02:10 PM Re: open, readline, close
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Pathologically Eclectic Rubbish Lister

Yeah ... definetly an alternative [Big Grin]
_________________________



Top
#98581 - 2003-02-19 02:25 PM Re: open, readline, close
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
that also describes part of Perl as well... [Big Grin]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#98582 - 2003-02-19 02:44 PM Re: open, readline, close
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Here is the actual command I use to audit my Squid proxy logs:
code:
zcat $(ls -tr access.log.*.gz) |cat - access.log|egrep -i "$(cat badwords)"|egrep -vi "$(cat goodwords)" >suspect.log
php -q suspect.php

The files "badwords" and "goodwords" contain the patterns that I am interested in.

The PHP script simply converts the log file to CSV for importing into Excel, converts timestamps to local time, and does a database lookup to the SQL proxy authorisation database to get users full names.

I use PHP rather than perl as perl gives me a blinding headache every time I read the O'Reilly book [Wink]

Top
#98583 - 2003-02-19 02:58 PM Re: open, readline, close
Crazy Eddie Offline
Starting to like KiXtart

Registered: 2002-11-20
Posts: 105
Loc: Sacramento, CA USA
You might also want to review this MS utility, as an alternative.

I've had great results using it to dump Event Logs to a CSV, and then upload them into SQL. (Note: The CSV step is optional for our environment. You could go directly.)

This is suprisingly good, considering the source. [Wink]

Microsoft Log Parser 2.0

quote:
Log Parser supports the following input formats:
IISW3C: Internet Information Services (IIS) W3C Extended format.
IIS: IIS-formatted and IIS-generated log files.
IISMSID: Generated when the MSIDFILT filter or the CLOGFILT filter is installed.
ODBC: IIS Open Database Connectivity (ODBC) format that reads data directly from the SQL table populated by IIS when the Web server is configured to log to an ODBC target.
NCSA: National Center for Supercomputing Applications (NCSA) format.
BIN: Binary file format that is generated by IIS 6.0. Contains the requests received by the virtual Web sites on the same server running IIS 6.0.
URLSCAN: Generated by the URLScan filter if it is installed on IIS.
HTTPERR: IIS 6.0 HTTP error log files format.
W3C: W3C log file format, such as for personal firewall, Windows Media Services, and Exchange tracking logs.
EVT: Event messaging format from the Windows Event log, including system, application, security, and custom event logs, as well as from event log backup files.
FS: File information from the specified path, such as file size, creation time, and file attributes. It is similar to an advanced dir command.
CSV: Generic comma-separated value format.
TEXTWORD: Generic text format.
TEXTLINE: Generic text format.
Log Parser supports the following output formats:
W3C: Sends results to a W3C text file that contains headers and values that are separated by spaces.
IIS: Sends results to a text file with values separated by commas and spaces but no headers.
SQL: Sends results to a SQL table using the ODBC Bulk Add command.
CSV: Sends results to a text file. Following an optional header, values are separated by commas and optional spaces.
XML: Sends results to an XML-formatted text file. The XML file is structured as a sequence of ROW elements, each containing a sequence of FIELD elements.
TPL: Sends results to a text file formatted according to a user-specified template.
NAT: Used for viewing native results on a screen.

(It is COM-able too.)

-Crazy Eddie
_________________________
{Insert your favorite Witty Tag Line here}

Top
#98584 - 2003-02-19 03:17 PM Re: open, readline, close
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Thank you all

Give the grep thing a try and let you know.

GR Peter

Top
#98585 - 2003-02-19 08:01 PM Re: open, readline, close
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Guys,

Jep Qgrep is the tool works much better.

Love this board.

GR Peter

Top
#98586 - 2003-02-19 08:04 PM Re: open, readline, close
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
grep, fantastic.

I like unix [Wink]
_________________________
!

download KiXnet

Top
#98587 - 2003-02-20 06:23 PM Re: open, readline, close
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You could also install a free SQL database like MySQL (even available for Win32 [Big Grin] ) and put the log files into that one.
_________________________
There are two types of vessels, submarines and targets.

Top
#98588 - 2003-02-20 07:54 PM Re: open, readline, close
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jens, yeah...
but isn't that little overshooting of this thingie?

simple text-file and it can be solved with simple way... no need to make it complex.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 363 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.068 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org