notas:squid
Diferencias
Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
notas:squid [2011/01/14 14:04] – cayu | notas:squid [2018/11/27 13:58] (actual) – [Formato de LOG] cayu | ||
---|---|---|---|
Línea 144: | Línea 144: | ||
< | < | ||
- | acl MSN_Method | + | acl MSN_Method |
- | acl MSN_Agent | + | acl MSN_Agent |
- | acl MSN_Agent | + | acl MSN_Agent |
- | acl MSN_Mime | + | acl MSN_Mime |
- | acl MSN_Port | + | acl MSN_Port |
- | acl MSN_Dom | + | acl MSN_Dom |
- | acl MSN_Url | + | acl MSN_Url |
acl MSN_Usr | acl MSN_Usr | ||
</ | </ | ||
Línea 191: | Línea 191: | ||
===== Blacklist ===== | ===== Blacklist ===== | ||
- | |||
- | |||
Listado de sitios prohibidos organizados por categorias. A continuacion describimos cada unas de las mismas: | Listado de sitios prohibidos organizados por categorias. A continuacion describimos cada unas de las mismas: | ||
- | ^^Categoria^Descripcion^^ | + | ^Categoria^Descripcion^ |
|ads | |ads | ||
|adult | |adult | ||
Línea 267: | Línea 265: | ||
|webmail | |webmail | ||
|whitelist | |whitelist | ||
- | |||
=== Referencias === | === Referencias === | ||
- | + | ^URL^Descripción^ | |
- | ^^URL^Descripción^^ | + | |
|http:// | |http:// | ||
|http:// | |http:// | ||
|http:// | |http:// | ||
|http:// | |http:// | ||
- | |||
===== Formato de LOG ===== | ===== Formato de LOG ===== | ||
Línea 286: | Línea 281: | ||
//Script a cual por medio de una pipe se le envia el access.log, lo analiza y nos interpreta el formato de fecha// **UNIX** //a formato de fecha// **Human Readable** :-P. | //Script a cual por medio de una pipe se le envia el access.log, lo analiza y nos interpreta el formato de fecha// **UNIX** //a formato de fecha// **Human Readable** :-P. | ||
+ | <code bash> | ||
+ | cat access.log | perl -p -e ' | ||
+ | </ | ||
+ | Otra opción : | ||
<code perl> | <code perl> | ||
# | # | ||
Línea 318: | Línea 316: | ||
Enlace interesante: | Enlace interesante: | ||
+ | |||
+ | ===== Script para ver los top sites ===== | ||
+ | |||
+ | <code perl> | ||
+ | # | ||
+ | ## | ||
+ | ## Squid Top Sites reporting script. | ||
+ | ## | ||
+ | ## Description: | ||
+ | ## This script will parse the specified squid logfile and count up the | ||
+ | ## | ||
+ | ## sites. | ||
+ | ## | ||
+ | ## Author: | ||
+ | ## Dave Hope - http:// | ||
+ | ## Sava Chankov ( Author of squid-report.pl ) | ||
+ | ## | ||
+ | ## Known Issues: | ||
+ | ## + Requests to the webserver on the proxy give weird results? | ||
+ | ## | ||
+ | ## Changelog: | ||
+ | ## | ||
+ | ## 1.0.1 | ||
+ | ## + Changed to have configuration held in-file. | ||
+ | ## + Removed last-visited date. | ||
+ | ## + Consolidated sites with/ | ||
+ | ## + Improved UI slightly. | ||
+ | ## 1.0.2 | ||
+ | ## + Fixed issue with accessing on ports other than 80. | ||
+ | ## + Fixed promblem with ftp:// entries in log. | ||
+ | ## | ||
+ | ## 1.2.0 | ||
+ | ## + Added ability to sort by size, rather than frequency. | ||
+ | ## | ||
+ | ## License: | ||
+ | ## This program is free software; you can redistribute it and/or modify it | ||
+ | ## under the GNU General Public License. | ||
+ | ## | ||
+ | ## This script is based on ' | ||
+ | ## been adjusted for my specific requirements. | ||
+ | ## | ||
+ | ## The original script can be found here: | ||
+ | ## | ||
+ | ## | ||
+ | |||
+ | use strict; | ||
+ | |||
+ | ## | ||
+ | # Configuration. | ||
+ | ## | ||
+ | my $cfgNumberToShow = 250; | ||
+ | my $cfgLog = "/ | ||
+ | my $cfgOutput = "/ | ||
+ | |||
+ | # by_times_visited_then_name or by_size_then_name | ||
+ | my $cfgSortMethod = " | ||
+ | |||
+ | |||
+ | ## | ||
+ | # Stop editing here unless you know what you're doing. | ||
+ | ## | ||
+ | my $cfgDate = gmtime; | ||
+ | my $row; | ||
+ | my($epoch_time_miliseconds, | ||
+ | my($unknown_integer2, | ||
+ | my($site_url, | ||
+ | |||
+ | |||
+ | ## | ||
+ | # Open output file | ||
+ | ## | ||
+ | open(OUTPUT, | ||
+ | |||
+ | |||
+ | ## | ||
+ | # Print header HTML | ||
+ | ## | ||
+ | print OUTPUT << | ||
+ | < | ||
+ | <html xmlns=" | ||
+ | <head profile=" | ||
+ | < | ||
+ | <meta http-equiv=" | ||
+ | <style type=" | ||
+ | <!-- | ||
+ | body { font: normal 1.0em ' | ||
+ | ul { list-style-type: | ||
+ | ul a { position: absolute; left: 150px } | ||
+ | # | ||
+ | #Footer { color: #cecece; line-height: | ||
+ | --> | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <p id=" | ||
+ | <ul> | ||
+ | END | ||
+ | |||
+ | |||
+ | ## | ||
+ | # Iterate through lines inaccess.log | ||
+ | ## | ||
+ | open(LOG, " | ||
+ | | ||
+ | while(< | ||
+ | { | ||
+ | $row = $_; | ||
+ | |||
+ | ($epoch_time_miliseconds, | ||
+ | |||
+ | # Not checking for http:// etc because we want to include CONNECT' | ||
+ | # multi-protocol data. | ||
+ | $url =~ s/ | ||
+ | $url =~ s/ | ||
+ | $url =~ s/www.//; | ||
+ | $url =~ s/\/$//; | ||
+ | |||
+ | # If the url is empty (which occurs occasionally in my logs, no idea | ||
+ | # why, then don't add it to the list. | ||
+ | if (!$url ) | ||
+ | { | ||
+ | next; | ||
+ | } | ||
+ | |||
+ | # Patern match data between slashes. | ||
+ | ($site_url) = ($url =~ m{ ([A-Za-z0-9.\-: | ||
+ | |||
+ | # Only match html content. | ||
+ | if($content_type =~ m{text/ | ||
+ | { | ||
+ | # If hash already contains an entry for the exact URL. | ||
+ | if ($sites{$site_url}) | ||
+ | { | ||
+ | | ||
+ | } | ||
+ | # If no matching entry exists, create one. | ||
+ | else | ||
+ | { | ||
+ | $sites{$site_url}-> | ||
+ | } | ||
+ | } | ||
+ | |||
+ | # Update size of content for website regardless of content-type. | ||
+ | if (!$sites{$site_url}-> | ||
+ | { | ||
+ | $sites{$site_url}-> | ||
+ | } | ||
+ | $sites{$site_url}-> | ||
+ | } | ||
+ | |||
+ | |||
+ | ## | ||
+ | # Iterate through visited sites. | ||
+ | ## | ||
+ | foreach $site_url ( sort ($cfgSortMethod keys (%sites) ) ) | ||
+ | { | ||
+ | # Only show top x entries. | ||
+ | if ($cfgNumberToShow > 0) | ||
+ | { | ||
+ | if ($cfgSortMethod eq " | ||
+ | { | ||
+ | print OUTPUT " | ||
+ | } | ||
+ | elsif ($cfgSortMethod eq " | ||
+ | { | ||
+ | print OUTPUT " | ||
+ | } | ||
+ | |||
+ | $cfgNumberToShow--; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | ## | ||
+ | # Print Footer HTML | ||
+ | ## | ||
+ | print OUTPUT << | ||
+ | </ | ||
+ | <div id=" | ||
+ | </ | ||
+ | </ | ||
+ | END | ||
+ | |||
+ | |||
+ | ## | ||
+ | # Sort sites by frequency visited, then alphabetically. | ||
+ | ## | ||
+ | sub by_times_visited_then_name { | ||
+ | $sites{$b}-> | ||
+ | || | ||
+ | $a cmp $b | ||
+ | } | ||
+ | |||
+ | ## | ||
+ | # Sort by size, then alphabetically. | ||
+ | ## | ||
+ | sub by_size_then_name { | ||
+ | $sites{$b}-> | ||
+ | || | ||
+ | $a cmp $b | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # Version: 1.0 | ||
+ | # Copyright: Bryant H. McGill - 11c Lower Dorset Street, Dublin 1, Ireland | ||
+ | # Web Address: http:// | ||
+ | # Use Terms: Free for non-commercial use, commercial use with notification. | ||
+ | # | ||
+ | # Legal: This code is provided "as is" without warranty of any kind. | ||
+ | # The entire risk of use remains with the recipient. | ||
+ | # In no event shall Bryant McGill be liable for any direct, | ||
+ | # consequential, | ||
+ | # | ||
+ | sub format_size{ | ||
+ | my($bytes) = @_; | ||
+ | |||
+ | return '' | ||
+ | |||
+ | my($size); | ||
+ | $size = $bytes . ' Bytes' if ($bytes < 1024); | ||
+ | $size = sprintf(" | ||
+ | $size = sprintf(" | ||
+ | $size = sprintf(" | ||
+ | $size = sprintf(" | ||
+ | |||
+ | return $size; | ||
+ | } | ||
+ | </ |
notas/squid.1295013899.txt.gz · Última modificación: 2011/01/14 14:04 por cayu