News: Sensation!!! Get viagra online Picture of generic xanax Buy cheapest online place viagra Lopid Side effects of the drug tramadol Phentermine free delivery Phentermine shipped to florida Permax Actos Cialis effective soft tab treatment Singulair Chromium Chantix Loracarbef Danaparoid Phenyltoloxamine Buy cheap viagra online uk Fast acting viagra Phentermine buy order Physican's desk reference phentermine Abbr href rel title title viagra Buy Lortab Inderal Mephenytoin Cheapest diet phentermine pill Ceclor Diet diet dieting phentermine pill Bendroflumethiazide Xanax 2 mg Phentermine with no prior prescription Ceclor 20mg cialis Online consultation phentermine Xenical Nylidrin Buy viagra on line Phentermine and atkins diet Alavert Buy phentermine online without prescription Phentermine without a prescription Diflucan Zithromax Filling online prescription viagra Phentermine withdrawal Zanaflex Tinzaparin Uk viagra sales Viagra cheap Cosopt Duragesic L arginine natural viagra Phentermine no rx needed Nitrofurantoin Efavirenz 5 mg sale Coumadin Payment Phentermine Viagra herbal Sufentanil Phentermine pharmacys online Cefixime Pantoprazole Fluorescein Pepcid Losartan 50 hcl mg tramadol Tramadol no prescription Buy prescription tramadol without No prescription viagra Alternative herbal review viagra Perscription phentermine Nizoral Letrozole Phentermine pharmacy Viagra users Phentermine canadian pharmacy 92 accepted cod phentermine Viagra usage Atenolol Phentermine cheapest price Phentermine pill Percocet Buy cheap fioricet Perphenazine Ribavirin Herbal viagra for women Viagra generico impotencia Botox Buy Prozac Celebrex Glipizide Black market costa rica pharmacy phentermine no imprint code Viagra uses Cyclacillin Buy Zyban Minoxidil Diet phentermine pill Cheapest cialis price Grapefruit xanax Viagra and high blood pressure Prevacid Buy phentermine in the uk Estrogen Phentermine online ordering Minipress Prescription weight loss medication phentermine Vidarabine Phentermine cod overnight Xanax xr Klonopin versus xanax Free pack sample viagra Prednisolone Taking phentermine with antidepressants Phentermine without rx On line pharmacy phentermine No prescription xanax Cheap online phentermine prescription Cheap cialis Piperacetazine Generic viagra uk Mechlorethamine Addiction tramadol Buy viagra 1 Tramadol used for Buy Wellbutrin Methylergonovine Soma sleep 5 diet pills Difference between cialis and viagra Comparisons on online viagra suppliers Viagra prescription medication Pictures of xanax pills Ibuprofen Drug interactions with cocaine and viagra Pheniramine Use of viagra Xanax shipped cod Physostigmine Cilostazol Recreational viagra use Dangers of xanax and klonopin addiction Discounted phentermine with no prescription Hydrocodone prescription Procainamide Phentermine delivered cod Thioguanine Lamotrigine Phentermine on sale Nicorette Can woman take viagra Lipitor Doxylamine Phentermine overnight Acquisto cialis Cefamandole Xanax xr 3 mg Pharmacy online phentermine Stopping xanax Buy Ultram Viagra retail discount Effects of xanax Guanadrel 5 Aerobid Piperidolate Phentermine resident sale virginia Generic ambien Isoflurophate Lowest priced viagra in the uk Tramadol without a prescription Cortisol Erythromycin Buy online salescom viagra Climara Oxcarbazepine Dirithromycin Diazepam Doxycycline Phentermine prescribed online Tramadol cod Lowest price phentermine What is xanax used for Xanax prescription Viagra and levivia Phentermine next day Diatrizoate Dexfenfluramine Buy cheap no phentermine prescription Tramadol without prescription Natural alternative viagra Prednisone Sulfasalazine Buy viagra online cheap Viagra levivia Alprazolam Benicar Phentermine alternatives Tramadol medicine Xanax overnight Akane soma Viagra dose Lovastatin Phentermine and fast shipping Mark martin viagra photo Minocycline Perscription cialis Order xanax overnight Pravastatin James thompson viagra lawsuit Provigil Eulexin 5 mg free shipping Ups cod phentermine Methyclothiazide Nolvadex Allopurinol Xanax drug testing Xanax drug test Brand drug generic name viagra Verapamil Xanax drug tests Phentermine price comparison Lisinopril versus viagra Phentermine effects Lunesta Chloroquine Avandamet Phenobarbital Purchase vicodin Xanax no prescription required Hydrocortisone Phentermine saturday delivery Acetazolamide Tamoxifen Generic viagra fast shipping Phentermine 180 Phentermine free prescription Kaopectate Viagra alternative Aprotinin How long does xanax stay in your system Vasotec Phentermine no consultation Carbenicillin Vicodin effects Dioxyline Phenytoin Enoxacin Pindolol Tolazamide Epoprostenol Cyclobenzaprine Vicodin information Order phentermine on line Viagra 6 free samples Online phentermine prescriptions Xanax drug information Where to buy phentermine Mycostatin Cialis experiences Anxiety disorder xanax xr to wean off effexor xr Blue 30 mg 90 free shipping phentermine pharmacy Phentermine hormone Climara Phentermine prozac Canada cialis Viagra 6 free sample Clomiphene Cause rebound weight gain phentermine Cheap phentermine perscription Methoxamine Zithromax Free ambien Viagra alternatives Cyclophosphamide Pilljar phentermine Phentermine capsules Buy xanax Submit a site viagra Esomeprazole Xanax anxiety Purchase tramadol online Acetaminophen fioricet Colesevelam Cheapest viagra on line Viagra tablet Tramadol 180 Tramadol without perscription Dihydrotachysterol Generic sample viagra Augmentin Phentermine Cephalothin Nitrofurantoin Carbamazepine Vitamin Mebendazole Paxil with phentermine interactions How does phentermine work Enebrel Buying phentermine without prescription Hydrocodone apap Lisinopril Amlodipine Viagra for woman study Nitroprusside Compare phentermine Xanax abuse Phentermine side effects 120 tramadol Women viagra Chlordiazepoxide Mylan xanax What happens when women take viagra Flutamide Piperacillin Cialis online Fenofibrate Viagra cream Review of herbal phentermine Hetacillin Phentermine prescriptions Soma addiction Diazepam Phentermine no prescription needed Phentermine no fees Xanax cash on delivery Trihexyphenidyl Viagra cialis comparison Soma drug Compare prices on phentermine Compare levivia viagra Levivia compared to viagra Fastin phentermine Phendimetrazine Flucytosine Buy online pharmacy viagra Buy cialis viagra Droperidol Fioricet order Uk cheapest viagra Enalapril Ceforanide Purchase soma Best price viagra Information viagra woman Carbinoxamine Aldactone Importing cialis from canada to us Buy no phentermine prescription Carbarsone Phentermine blue Dienestrol Buy Nexium Cheap tramadol no prescription Seroquel Probenecid Phentermine in stock ready to ship saturday delivery Discount tramadol Compare phentermine price Link myblogde online order viagra Saturday delivery phentermine Do companies sell phentermine with low dose ingredients Etretinate Mirapex Lethal dose xanax Buy phentermine shipped usps Xanax demerol morphine no prescription needed Phentermine directly and discreetly adipex Morphine Buy Tylenol Herbal phentermine forum Atenolol viagra Prescription order viagra online Get online viagra Effects from side viagra Compare levivia and viagra Xanax withdrawl message boards Prozac Phentermine dangers Mirtazapine Polythiazide Cheap phentermine online no prescription Phentermine tricks Combivent Generic viagra online pharmacy Viagra versand Lysodren Lovastatin Zalcitabine Opipramol Buy in phentermine uk Buy online viagra Amiodarone Chinese viagra dragon power Lotrimin Cheap overnight tramadol Viagra women Soma financial Non prescription viagra Time released phentermine Generic cialis price 2mg xanax Cheap tramadol prescriptions online Tramadol online cheap Aspirin Phentermine us Glyburide Levoxyl Phentermine hoodia diet pill Idoxuridine Phentermine + sale Estraderm Low cost viagra Phentermine gynecomastia Niaspan Phentermine law suits Ditropan Female spray viagra 00 phentermine Gitalin Free try viagra Cialis compare levivia viagra Phencyclidine Lethal doses of klonopin and xanax Cialis tablets Buy tramadol Phentermine able to beshipped to mo Bad side effects of viagra Xanax during pregnancy Differin Omnicef Long term effects of phentermine use Pulmonary hypertension viagra Flutamide Nasacort aciphex phentermine actos imitrex Pentasa Medroxyprogesterone Buy Cialis Ionamin phentermine yellow _cialis et levitra Does xanax show up on drug tests Zantac Order hydrocodone online Buy Acyclovir Adipex phentermine pill What is phentermine Clomipramine Viagra anxiety Phentermine online cod Epivir Isotretinoin Xanax withdrawal muscle joint nerve pain Cyclobenzaprine Zyrtec Xanax with same day delivery I need to identify pictures of phentermine Phentermine 37 5 Ambien cr Information viagra Buy xanax without a prescription Side effects of phentermine Phentermine and carbs Genaric viagra Medrol Bleomycin Difference between viagra and levivia Potassium Apomorphine Buy prescription viagra Gabapentin Phentermine dosage Generic overnight viagra Chenodiol Viagra patent expiration Phenergan Phentermine 15 mg Nasonex Pediacare Soma muscle Levivia viagra Add link phentermine purchase Carisoprodol Tramadol hc Online phentermine sale Adipex cheap phentermine Phentermine rx Dovonex Premphase Eldepryl Cheap prices phentermine Buy hydrocodone where Effects long phentermine side term Smoking xanax Long term side effects of phentermine Chlorprothixene Vicodin Ordering xanax online Amphetamine Description tramadol Online pharmacy prescription viagra Tramadol 377 Compare phentermine prices Bosch power tools zio lowest viagra Diclofenac Levivia vs cialis vs viagra Mepenzolate Viagra discount sale Adipex diet discount phentermine pill Buy hydrocodone online Phentermine very cheap Buy phentermine diet pill Lanoxin Order tramadol online Lowest cost generic viagra Cialis generic viagra Pictures of mylan xanax Cruises soma Free cialis samples Phentermine cash on delivery accepted Viagra in canada Podofilox Compare viagra to cialis Cheapest phentermine 90 day orders Xanax picture Does phentermine work Half price viagra Cheap diet phentermine pill Tramadol Elavil Naltrexone Buy Xenical Cefixime Order soma online Chlorpheniramine Buy discount viagra online Sell viagra online Tramadol hydrochloride capsules Viagra online cheap Nabumetone Purchase viagra on line Buy com lvivhost online viagra Clidinium Liver problems from xanax Generic sales viagra Restless leg syndrome phentermine Xanax online without a prescription Phentermine about withdrawl Cialis comparison viagra Clopidogrel Viagra faq Diet drug fenfluramine phentermine Free viagra Hexamethonium On line prescription viagra Cialis results Mometasone Buy online viagra viagra Xanax for dogs Chlorpropamide Nefazodone Apcalis cialis Cortisone 5 cheap Cheap phentermine diet pills Is phentermine dangerous Levofloxacin No perscription viagra Levivia viagra compared Buy online order viagra Drug information picture identification tramadol er bvf Phentermine delivered overnight Takin prozac and xanax Chep phentermine Niacin Ambien dosage Demeclocycline Phentermine cheap free shipping Busulfan Overnight xanax Divalproex Nizatidine Phentermine shipped to missouri Strattera Medical information on tramadol hc Otc viagra Abacavir Discount vicodin Purchase phentermine online Weight loss oral hcg and phentermine Order viagra without prescription India generic viagra Hydrocodone withdrawal Buy Meridia Doxycycline Woman use viagra Butriptyline Phenytoin Woman take viagra Cheapest phentermine free shipping Oxycontin xanax bars perclesept and lortab Hydrocodone m358 Cheap phentermine overnight Cheap fioricet Cheap phentermine without a prescription Invia nasal viagra Viagra kaufen Phentermine without perscription Loss phentermine story weight Real phentermine Pepcid Electricity Cheap discount phentermine Phentermine free shipping 90 supply no delay Discount phentermine free shipping Buy cheap online viagra How long between phentermine and meridia Fioricet line Order cialis Adipex diet phentermine pill Methotrimeprazine Valerian Trimethaphan Tripelennamine Bacitracin Pal pay phentermine Eulexin Trandolapril Alfentanil Elidel Phentermine and methamphetamine Digitalis Bethanechol Estrone Clemastine Hydrocodone Buy online viagra securely Dangers of phentermine Imiquimod Viagra advertisement Ampicilin Clomipramine Generic viagra cialis levivia buy cheap Discount online phentermine Crestor Cheapest prescription viagra Phentermine ionamin canada Buy phentermine prescription Indapamide Cialis testimonials Fioricet Discount phentermine online Natural supplement equivalent to xanax Viagra for sale online Buy phentermine on line Tramadol dogs Phentermine picture Buy Zyrtec Buy phentermine online with paypal Sparfloxacin Premarin Heart phentermine Mefloquine Where to buy viagra on line Cheapest viagra uk health risks Phentermine cheapest Us phentermine Cheapest place to buy phentermine online Adipex phentermine weight loss Cialis soft tabs Phentermine usa Cheapest phentermine diet pill Viagra info Mevacor Phentermine addiction help Buy phentermine online prescription Viagra patent Picture viagra pill Abilify Deslanoside Tramadol pharmacy Compare cialis levivia viagra Discount phentermine price Phentermine ky Xanax online cheap Mesalamine Lamivudine Meridia Carvedilol Pancuronium Overnight tramadol Xanax precriptions Natural alternative to viagra Comparison viagra cialis levitra Buy cialis uk Xanax dosing Phentermine blue 30 mg Meperidine Uk viagra supplier Cidofovir Amiloride Meprobamate Phentermine online Moexipril Cialis online discount Lomotil Buy cialis online Codeine Isotretinoin Phenacetin Phentermine lose weight loss diet pills Phentermine 30mg cap Amitriptyline Cefepime Online consultations and prescriptions phentermine Cialis price compare Nelfinavir Phentermine yellow 30 mg Imipenem Generic xanax photo 5 90 Custom hrt phentermine Anxiety panic disorder xanax Generic phentermine Viagra maker Tramadol narcotic Generic price viagra Phentermine drug test Order cheap phentermine Cheap 37 5 phentermine Phentermine insulin Hyzaar Herbal viagra for woman Celexa Mucomyst Hydrocodone vicodin Viagra ingredients Cyproheptadine Piperazine Low price phentermine Linezolid Aciphex 150 tramadol Tools needed for injecting xanax Which is better cialis or levitra Ethinamate Ergocalciferol Soma getting Methscopolamine Buy Fioricet Zetia Hydrocodone and ibuprofen Diet discount phentermine pill Meridia online Phentermine amide Cheapest cialis generic Nexium Phenelzine Phentermine weight loss medication Meclofenamate Phentermine ups delivery Cheapest phentermine diet pills Viagra experiences Soft cialis Lexapro and xanax Xanax death Aminopterin Pfizer xanax pills Online viagra sale Xanax indications Add link phentermine purchase suggest Ipratropium Wholesale pfizer viagra Lose weight with phentermine and 5 htp Xanax grapefruit juice Phentermine pill discount Phentermine online without a prescription Tramadol and dosage Etanercept Online pharmacy duromine viagra international Fluorouracil 5 mg Online viagra sales Guanabenz Viagra recreational Neurontin Generic cialis overnight Chlorzoxazone Desyrel Alternative to viagra Tretinoin Drug test tramadol Santa claus viagra jokes Viagra investigator Imitrex Meropenem Premphase Leflunomide Flagyl Famotidine Tramadol effects Online pharmacy phentermine Written prescription for viagra Order tramadol cod Order vicodin online Tramadol cheap overnight inexpensive 1 loss phentermine pill weight Geodon Ambien overdose Viagra overnight Esmolol Diflunisal Vicodin detox Online doctors perscriptions xanax steroids Klonopin xanax Orlistat Clonazepam Buy cheap cialis Cheapest tramadol online Buy Lipitor 90 $89 mastercard 5 mg diet pills Herbal alternative to viagra Side effects phentermine gynecomastia Xanax sexual side effects Accupril Mirena Compare viagra cialis levitra Generic purchase viagra Mephobarbital Cefatrizine Xanax interaction with paxil Miconazole Dicyclomine Female sexual inhancer viagra spray Phentermine vs adipex p Butorphanol Avandamet Moxalactam 180 tramadol Cheap cialis tablets Dangers of viagra Midazolam Diamox Piroxicam Online pharmacies with doctor consultation for viagra Keyword prescription qoclick tramadol without Capoten Picture of xanax pill Fosamax Lotrimin Xanax Griseofulvin Propylthiouracil Robaxin From generic india viagra Flosequinan Phentermine buy Buy ambien online Albendazole Ssri phentermine heart Tramadol hci Xanax without a prescription Order phentermine diet pill Cialis comparison viagra Cialis levivia sales viagra Tramadol and drug tests Acebutolol Cordarone Viagra alternatives uk Phentermine from a mexican pharmacy Ethosuximide Flupenthixol Tramadol and online pharmacy Lethal dose of xanax Cialis no prescription Loprox Prescriptions on line phentermine Diflucan Celecoxib Where to buy viagra online Quinacrine Indinavir

Archive for perl

Popular Posts

CiUI is an iPhone code library which helps developers create web applications with the look and feel of Apple’s iPhone. It was modeled after iUI and is used by CNET.  CiUI supports horizontal scrolling menu’s which are the trademark of the iPhone’s user interface. With CiUI, a web developer can build Safari web browser applications that look like a built in iPhone application.

***

The CiUI Safari page has another option which is labeled “Popular Posts”.  Here’s a link to the page (use an iPhone or Firefox):

http://www.core3.com/icore/i/ 

Clicking “Popular Posts” uses CiUI’s Javascript and CSS framework to display a list of titles ranked by the number of times the post has been downloaded.

 

 

 

 

 

 

 

 

 

 

 

*** 

In the example below, “Turn off autocorrect” is the number one downloaded post.  Click a title to see post content.

 

 

 

 

 

 

 

 

 

 

 

*** 

Data to drive the top ten list doesn’t come from the WordPress MySQL database.  Instead, it comes from the web server access log.

*** 

In an earlier post, a Perl script to parse the web server log file was presented.   The lines below add to that earlier Perl script by incrementing a hash named %count_Popular.

 

 

 

 

 

 

 

 

 

 

 

 

*** 

 After the hash is populated, the following lines sort the hash and write the first 40 lines into a file named popular.txt.

  

 

 

 

 

 

 

 

 

 

 

*** 

The file, popular.txt is then FTP’d up to the ISP server and used as input to drive the “Popular Posts” menu page. Here’s the file:

http://www.core3.com//icore/access/popular.txt

Each line of popular.txt is converted into a menu option.

 

Comments

RIPE

While looking through the server logs of iPhone Cafe, I noticed several hundred visits with the following URL: 

/wpblog/wp-trackback.php?tb_id=1

At first I thought this was another attack like the SQL injection attack that occured in May. These transactions had an ip address of 87.118.112.44 which when Googled, identified a site called RIPE Network Coordination Centre . I had never heard of the site, but it seems to be legitimate.  There’s a Wikipedia entry for it. I did, however, find this post asking for thoughts on how to block access from IP addresses connected to RIPE, so the visits may not be entirely benign.

Comments

Download Access Logs with Perl - Parsing V

This post describes how to download files using Perl and FTP.

*** 

An earlier post, Log Parsing III provided steps to scan web access logs in Perl and provided a sample script which scan’s a bunch of logs and then creates a web page of links to Google searches. Yet another Log Parsing Post, goes a step further and creates an iPhone formatted page of Google searches. Parsing for Google searches is just one of many, many things that can be done using access logs.

***

Since my ISP is Yahoo and I’m not paying for their premium account,  I don’t have a Unix shell  to run perl scripts. Before scanning a log, it needs to be copied from Yahoo to my personal PC. FTP is used here.

***

Perl makes it easy to copy, or download, files using FTP.

***

To use FTP in Perl, first make sure the package Net::FTP is referenced in the script, usually at the top of the script in a use statement.  The Net::FTP package lets you create simple FTP clients which can login, change directorys, set transfer modes, download or upload files, and logout. 

*** 

Below, the getFile() function wraps Net::FTP method calls into a subroutine that downloads access log files. You provide the user ID, password, hostname, and other parameters.  The function logs into the remote machine, changes to the target folder, and downloads files with names beginning with “access”. It returns a list of downloaded filenames. A regex skips files with names that don’t begin with “access”.
 

#—————————————————————–
# Function:  getFile
# Purpose:   Use ftp to copy log files from a remote machine to
#            the local machine.
#—————————————————————–
sub getFile
{
my $filename = shift;       # local filename (full path)
my $from_host = shift;      # To Host
my $from_folder = shift;    # To Folder
my $uid = shift;            # ftp login id
my $pwd = shift;            # ftp login password

my ($ftp);
my ($currentDir, $result);

$ftp = Net::FTP->new($from_host) or die “Can’t connect: $@\n”;

#— Login
$ftp->login($uid, $pwd ) or die “Can’t login with $uid and $pwd\n”;

#— get name of current directory
$currentDir = $ftp->pwd();

#— Change to the target directory
$ftp->cwd(”$from_folder”) or die “Can’t change directory\n”;

#— get name of current directory on remote machine
$currentDir = $ftp->pwd();

$ftp->ascii();  # set ascii transfer mode

#— print files in remote Dir
my @remotefiles;
my @localfiles;
undef @localfiles;
@remotefiles = $ftp->dir();
foreach my $longfilename (@remotefiles) {
   if ($longfilename =~ /access\w*\.log/) {
      $filename = $&;
      $filename =~ s/^\s+//g;
      print “\nGetting filename = [$filename] “;
      push(@localfiles, $filename);     
      }
   $ftp->get($filename);
   }

#— Disconnect
$ftp->quit() or warn “Couldn’t quit.  Oh well.\n”;

return @localfiles;
}

 

This function could be modified to move any file or combination of files.

Comments

Log Parsing IV

Wouldn’t it be neat to run a script against the access logs of your web server to see what Google queries resulted in visits to your site?  This web page shows output from such a script.  It lists search words that can be clicked to see the Google page which refered the visit.

***

Log Parsing III described how to scan WordPress web server logs for Google searches.  A complete script written in Perl was provided. Reviewing Google searches in your WordPress web server log is one method to determine which postings and topics are of interest. 

*** 

Output from the Google search script has now been incorporated into the mobile version of iPhone Cafe. To access it, go to iPhone Cafe’s Home page, scroll down, and select Searches from the footer menu.  A page full of search words will display with most recently used words at the top.

 ***

The Searches page contains lots of data and much of it is repetative since two or three iPhone Cafe pages recieve the majority of Google hits.  It’s interesting to see searches originating from all over the world including countries like Belgium, England, Germany, Poland, UAE, India, Vietnam, China, Canada, and others. Is the iPhone really for sale in all  these countries? Most searches result in the typical Google search display, however, one particular search displays in a format I’ve never seen on Google. See the snapshot below. Maybe someone is using Google’s API to construct their own search result pages. 

***

Comments (1)

Log Parsing III

April 30th, 2008 - See Popular Posts for a sample iPhone web page which uses web server log scanning described here to create a clickable top ten list of the most popular weblog titles.

***

In an earlier post, Log Parsing II, I described scanning the Apache access log with Perl to build an html file containing Google searches of your site.  Here’s a link to the complete example script:

Example Script - Googles Searches

The example script runs on Mac or Windows PC. It downloads the latest access logs to a local folder containing an archive of previously downloaded logs. It scans every log in the local archive folder. References to Google searches are written to an output file. When the local archive folder is completely scanned,  the output HTML file is uploaded to the service provider’s host.  The script should be run once per day. Many service providers keep the current access log plus one or two rotated logs.

***

Before running the script, change hostname, login name and password as needed.  Also, change the script name from googleSearches_pl.txt to googleSearches.pl.  If you don’t have Perl, you can download it free from ActiveState.  Mac and Windows versions of Perl are availible for download. With Perl installed locally, the command to run the log scanning script is perl googleSearches.pl.

***

Output from the script should look something like [this].  The script contains a function named htmlBegin(). Use this function to set ”page title”, ”body title”, and “banner image” to any values desired.

***

Improving the Script

The obvious place to improve the script is to replace the multi-line regex with a single line regex for parsing the Apache log.  A web page named A Simple Apache Log Parser contains an example of a single line Apache line parsing regex which looks promising.  More to come……

***

About the Script 

Reducing Noise - Access logs contains lots of “noise” that’s created when a web site is accessed by robots or when requests download pages composed of multiple images or javascript include files. Reducing noise provides a more realistic view of visits to the site. 

*** 

Weblog noise reduction can be done by searching for and rejecting lines in the log containing words or strings we don’t really care about.  How do you determine which words or strings indicate a line should be rejected? The best way may be to just look through the unfiltered access log. Simply eyeballing the unfiltered log will reveal plently of lines that can be classified as noise. 

*** 

Once noise lines are identfied, choose words or strings that occur only in lines of noise and load the strings into an array or hash. Then build a function around it. The sample function below is  from iPhone Cafe.  Character strings are pushed onto the @discard array and a regex evaluates true for lines containing discard strings which returns false from the perl function causing the calling script to skipt the current line read another line from the access log.

#—————————————————————–
# Function:  discard
# Purpose:   Return true if the input line contains a character
#            string indicating we dont care about the line of text.
#—————————————————————–
sub discard
{
my $lineOfText = shift;

my $weDontCare = 0;  # initialyze return variable
my @discard;  # initialyze array to hold discard strings

# Load the discard array
push(@discard, “ocadia”);
push(@discard, “themes”);
push(@discard, ‘24\.18\.’);
push(@discard, ‘76\.114\.206′);
push(@discard, ‘\.css’);
push(@discard, ‘\\/js’);
push(@discard, ‘\.png’);
push(@discard, ‘favicon\.ico’);
push(@discard, ‘\/image\/background’);
push(@discard, ‘wp-admin\/images’);

# Compare the input line to the list of discard strings
foreach my $discardString (@discard) {
   if ($lineOfText =~ /$discardString/i) {
      $weDontCare = 1;  # this line contains a word that eliminates it.
      }
   }

return $weDontCare;
}
 

 

Related Pages:

Viruses, Spyware and other Nasties

 

Comments (4)

Who’s Googling Who? Log Parsing II

Wouldn’t it be neat to run a script against the access logs of your web server to see what Google queries result in visits to your site?  The output from such a log scanning script might look like [this] page where the timestamp and URL of Google driven visits are displayed.  And, the URL is a link which is clicked to see the original Google search result as viewed by the person entering keywords into Google’s search page.  A page like this can help the site owner understand, among other things, which topics are most popular and which pages are structured effectively.

***

In Apache Log Parsing I described a method to unpack web server log files so they could be analyzed for visitor traffic patterns. Since then, I’ve use the parser on my own web server logs and been looking through the output.

***

After a bit, I noticed something surprising in the logs. The referer section of certain log entries contained what appeared to be a Google search URL.  This was confirmed by copy/pasting a few of these into my browser.  Running the URLs in my browser produced a Google search page, and sure enough, somewhere on the Google page was a link to IPhone Cafe.  

***

I thought, “Wow, assuming these aren’t robot transactions, I can now see what IPhone Cafe content is of greatest interest to real people”.  Disabling IPhone’s autocorrect seems to be the number one topic. Many IPhone autocorrect searches originate in Europe.  Moving contact information from old phone to iPhone is another popular topic.

*** 

I couldn’t afford to spend a bunch of time manually eyeballing access logs. So, I modified the log parsing script to open an output file and fill it with lines containing Google search URLs. While doing this, the script wraps HTML anchor tags around search URLs and then FTP’s the HTM file up to a folder on my ISP’s server.

*** 

The resulting, uploaded, Google search file is located [here].  The large fonts are formated for IPhone’s Safari browser but it still looks pretty much okay in a desktop browser.  Clicking a link displays the original Google search from my web server access log.  Pretty neat.

*** 

The Perl script which parses, formats, and does the ftp upload should work for just about any web site, IPhone related or not, so I’ll post the complete script [here] after cleaning it up a bit.

Tony

 

Comments (2)

Apache Log Parsing

March 2nd Note: See Log Parsing III for the conclusion to this topic. 

***

Regular expressions (regex’s) are great for manipulating character strings. I’ve used them for years, but haven’t gone beyond ”beginner” to “intermediate” proficency and admire scripters who’ve mastered complex regular expressions.  

***

After developing IPhone Cafe, I wanted to examine traffic patterns using web server access logs provided by Yahoo which runs on Apache.  Anyone familiar with Apache knows its logs contain lots of visitor information packed into each line.  Examining traffic patterns means parsing or “unpacking” lines. This is a perfect job for regular expressions.

***

Chapter 20 of Perl Cookbook, by Tom Christiansen and Nathan Torkington presents a one line regular expression to extract values from an access log.  Perl Cookbook is a great reference loaded with lots of nifty scripts. My copy is dog earred because I routinely reach for it to find scripting solutions.  However, I’ve never had success with the one line regex approach for parsing web logs. Must be a mental block on my part.

***

Searching on Google, I found a page titled Parsing Apache Access Logs using PHP  which uses a different approach; a multi-line regex approach. Instead of a single one line expression, the author of the PHP page uses multiple expressions to parse the log line from beginning to end.  My ISP uses Apache’s Combined Log Format which contains the following elements:

host, datetime, method, url, protocol, status, bytes, referer, client

The multi-line regex approach uses separate regular expressions to match each element, starting with the first element, ’host’, moving through the line until reaching the last element ’client’.  As each element is matched, the ‘post-match’, e.g. everthing to the right of the match is stored and used in the next match.

***

The multi-liner approach isn’t nearly as elegant as the one line regex, e.g. it’s a hack; however, for me, it’s easier to work with and debug since it breaks one big “pattern match” into a number of smaller matches which can then be individually tested.

The code sample in the link below isn’t pretty, however it works for me.  It’s a Perl subroutine where the first parameter contains a single line from the web server access log. The other parameter is for output and is a reference to a hash defined in the main script [more on references].  Here’s a link to the code:

Code Sample - Log Parse

 Here’s a usage example:

my %rec;
&parseLogLine($thisLine, \%rec);
print “IP Address = ” . $rec{’host’}; . “\n”; 

The parsing subroutine is part of a Perl script which downloads log files from the ISP, parses them, and produces summary reports showing visits to IPhone Cafe. The summary report contains totals by robots, desktop browsers, IPhone Safari browsers, etc.

***

Visit Log Parsing II for an example showing how web access log information can be used.

- Tony

Comments