Sponsored Content
Top Forums Shell Programming and Scripting SH script to split squid log by date Post 302280369 by _MCRH_ on Monday 26th of January 2009 04:44:25 PM
Old 01-26-2009
Hi Franklin52

I want to analize squid's log file "access.log", it look like this:

1232935790.356 1795 192.168.0.10 TCP_MISS/200 551 GET http://www.cubachat ...
1232935790.383 1645 192.168.0.55 TCP_MISS/302 619 GET http://images.imagef ...
1232935791.271 888 192.168.0.55 TCP_MISS/302 618 GET http://images.imagef ...
1232935796.064 1444 192.168.0.55 TCP_MISS/302 619 GET http://images.imagef ...
1232935797.477 1412 192.168.0.55 TCP_MISS/302 618 GET http://images.imagef ...
1232955307.426 527 192.168.0.10 TCP_CLIENT_REFRESH_MISS/407 2116 GET Free Download Manager - absolutely free download accelerator and manager ...
1232955307.703 804 192.168.0.10 TCP_MISS/407 2072 GET http://webmail.rimed ...
1232955315.375 1266 192.168.0.10 TCP_MISS/407 1614 GET http://webmail.rimed ...
1232955322.071 1633 192.168.0.10 TCP_MISS/407 1614 GET http://webmail.rimed ...


The first field of the log is the date and time in UNIX format (seconds since 1/1/1970). Analizing this field (as proposed in my first post), two dates as registered: jan 25 2009 and jan 26 2009, thus two files must be generated:

2009-01-25 containing:
1232935790.356 1795 192.168.0.10 TCP_MISS/200 551 GET http://www.cubachat ...
1232935790.383 1645 192.168.0.55 TCP_MISS/302 619 GET http://images.imagef ...
1232935791.271 888 192.168.0.55 TCP_MISS/302 618 GET http://images.imagef ...
1232935796.064 1444 192.168.0.55 TCP_MISS/302 619 GET http://images.imagef ...
1232935797.477 1412 192.168.0.55 TCP_MISS/302 618 GET http://images.imagef ...

and
2009-01-26 containing:
1232955307.426 527 192.168.0.10 TCP_CLIENT_REFRESH_MISS/407 2116 GET Free Download Manager - absolutely free download accelerator and manager ...
1232955307.703 804 192.168.0.10 TCP_MISS/407 2072 GET http://webmail.rimed ...
1232955315.375 1266 192.168.0.10 TCP_MISS/407 1614 GET http://webmail.rimed ...
1232955322.071 1633 192.168.0.10 TCP_MISS/407 1614 GET http://webmail.rimed ...



Any help would be apreciated,

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split the access.log based on date

I am trying to get the content of Apache access.log file for the current date for viewing purposes. I can get it with the following sed command sed -n '/09\/Oct\/2008/,/09\/Oct\/2008/p' access.log | less now I want to enhance it such that it will automatically take current date instead of... (4 Replies)
Discussion started by: ysprathap
4 Replies

2. Shell Programming and Scripting

Script to copy log files with today's date

I am a newbie to scripting. I need a korn shell script to copy log files of current day to archive folder and rename with current days date stamp. I would really appreciate your help. File structure is as follows. Everyday files get overwritten, so I need copy to a archive directory and... (3 Replies)
Discussion started by: mdncan
3 Replies

3. Shell Programming and Scripting

Split the file based on date value

Hi frnds, I have flat file as . Say : output-file1.txt Output-file2.txt (1 Reply)
Discussion started by: Gopal_Engg
1 Replies

4. Shell Programming and Scripting

Filtering the yesterdays date from log files via script.

hi All, I have this sample text file - access.log: Jan 18 21:34:29 root 209.151.232.70 Jan 18 21:34:40 root 209.151.232.70 Jan 18 21:34:43 root 209.151.232.70 Jan 18 21:34:56 root 209.151.232.70 Jan 18 21:35:10 root 209.151.232.70 Jan 18 21:35:23 root 209.151.232.70 Jan 18 21:36:04 root... (2 Replies)
Discussion started by: linuxgeek
2 Replies

5. Shell Programming and Scripting

Split Date/time data to two

Hi all, I have logs(in a log file) with the following structure 20100916011501559;0.812;null;TRUE;;FALSE;0.812;0;0;;19 20100916011504762;0.015;null;TRUE;;FALSE;0;4|4;0.015;;4 20100916011504762;0;null;TRUE;;FALSE;0;0;0;;4 20100916011501731;3.343;null;TRUE;;FALSE;3.156;131|65;0.172;;11... (14 Replies)
Discussion started by: babai
14 Replies

6. IP Networking

Squid vs iptables = no Squid access.log?

Hello, I have a pretty useless satellite link at home (far from any civilization), so I wanted to set up caching in order to speed things up. My Squid 2.6 runs "3128 transparent" and is set up quite well on a separate machine. I also have my dd-wrt router to move all port 80 traffic through... (0 Replies)
Discussion started by: theWojtek
0 Replies

7. UNIX for Advanced & Expert Users

Change Log Path for Squid on Centos 6

I searched and did not find a useful answer. Can someone please tell me the best practice to change the log directory from /var/log to /opt/squid? (4 Replies)
Discussion started by: glev2005
4 Replies

8. Shell Programming and Scripting

Delete log files content older than 30 days and append the lastest date log file date

To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies

9. Shell Programming and Scripting

Squid proxy shell script

i need squid proxy log file daily auto generate by shell script (1 Reply)
Discussion started by: sanjeetkumar086
1 Replies

10. UNIX for Dummies Questions & Answers

I need a Script to read Log string and check date at the same time

I need to check 1 log file, which is logging: 2014-08-18T09:10:39+02:00 user: XXXXX START FEATURE 2014-08-18T09:10:39+02:00 user: XXXXX FINISH FEATURE I first need to check that the START FEATURE starts and finish on the same time/date for the same user, which is different each time START... (2 Replies)
Discussion started by: TheBest43
2 Replies
Perlbal::Plugin::Palimg(3pm)				User Contributed Perl Documentation			      Perlbal::Plugin::Palimg(3pm)

NAME
Perlbal::Plugin::Palimg - plugin that allows Perlbal to serve palette altered images VERSION
This documentation refers to "Perlbal::Plugin::Palimg" that ships with Perlbal 1.50 DESCRIPTION
Palimg is a perlbal plugin that allows you to modify "GIF" and "PNG" on the fly. Put the images you want to be able to modify into the "DOCROOT/palimg/" directory. You modify them by adding "/pSPEC" to the end of the url, where SPEC is one of the below defined commands (gradient, tint, etc). CONFIGURING PERLBAL
To configure your Perlbal installation to use Palimg you'll need to "LOAD" the plugin then add a service parameter to a "web_server" service to activate it. Example "perlbal.conf": LOAD palimg CREATE SERVICE palex SET listen = ${ip:eth0}:80 SET role = web_server SET plugins = palimg SET docroot = /usr/share/doc/ SET dirindexing = 0 ENABLE palex GRADIENTS
You can change the gradient of the image by adding "/pg0011111164ffffff" to the end of the url. 00 is the index where the gradient starts and 111111 is the color (in hex) of the beginning of the gradient. 64 is the index of the end of the gradient and "ffffff" is the color of the end of the gradient. Note that all colors specified in hex should be lowercase. Example: http://192.168.0.1/palimg/logo.gif/pg01aaaaaa99cccccc TINTING
You can tint the image by adding "/pt000000aaaaaa" to the end of the url. 000000 should be replaced with the color to tint towards. "aaaaaa" is optional and defines the "dark" tint color. Both colors should be specified as lowercase hex numbers. Example: http://192.168.0.1/palimg/logo.gif/pt1c1c1c22dba1 PALETTE REPLACEMENT
You can specify a palette to replace the palette of the image. Do this by adding up to six sets of seven hex lowercase numbers prefixed with "/p" to the end of the URL. Example: http://192.168.0.1/palimg/logo.gif/p01234567890abcfffffffcccccccddddddd BUGS AND LIMITATIONS
There are no known bugs in this module. Please report problems to the Perlbal mailing list, http://groups.google.com/group/perlbal Patches are welcome. AUTHORS
Brad Fitzpatrick <brad@danga.com> Mark Smith <junior@danga.com> LICENSE AND COPYRIGHT
Artistic/GPLv2, at your choosing. Copyright 2004, Danga Interactive Copyright 2005-2007, Six Apart Ltd perl v5.14.2 2010-12-20 Perlbal::Plugin::Palimg(3pm)
All times are GMT -4. The time now is 06:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy