The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Previous Message  |  Next Message 
 Grabbing specific fields from a log file
Author: Dan Langille 
Date:   29-11-02 00:44

A few weeks ago, I notice some odd things in my web server log files. So I wanted to collect some information.

They had strange referrer values so I did this to get all the IP addresses in question:

# grep http://example.org /usr/websites/log/freshports.org-access.log | awk '{print $1}' | sort | uniq | less
192.168.0.190
192.168.0.191
192.168.0.192
192.168.0.193
192.168.0.194
192.168.0.195
192.168.0.196
etc...

This gave me a long list of IP addresses, but there were common elements, so I did this to find all the various referrer values:

egrep "192.168.0.|10.0.2.|10.2.1.|10.3.8." /usr/websites/log/freshports.org-access.log | awk '{print $11}' | sort | uniq | less

"http://example.org/bet/"
"http://example.com/all/"
"http://example.net/2/"
"http://example.biz"

This gave a long list of the interesting referrers...

 Reply To This Message  |  Forum List  |  Flat View   Newer Topic  |  Older Topic 

 Topics Author  Date
 Grabbing specific fields from a log file   new
Dan Langille 29-11-02 00:44 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org