Sponsored Content
Top Forums Shell Programming and Scripting awk script to find time difference between HTTP PUT and HTTP DELETE requests in access.log Post 302976842 by balajesuri on Thursday 7th of July 2016 03:24:44 AM
Old 07-07-2016
Code:
[user@host ~]$ cat test.sh
#! /usr/bin/bash

file=$1
logfile="file"

in_dt=$(grep "PUT.*$file" $logfile | cut -d' ' -f1,2)
out_dt=$(grep "DELETE.*$file" $logfile | cut -d' ' -f1,2)

in_dt_s=$(date -d"$in_dt" +%s)
out_dt_s=$(date -d"$out_dt" +%s)

echo "File: $file; Difference: $(( out_dt_s - in_dt_s ))"
[user@host ~]$ ./test.sh file_30
File: file_30; Difference: 21
[user@host ~]$

Parameterize accordingly.
This User Gave Thanks to balajesuri For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

turning off certain http requests

On a sparc solaris 8 host running sunone webserver 6 I would like to limit the http requests that can be used when port 80 is accessed. We currently have http/1.0 enabled. For example I would like to remove the http request DELETE. Regards, BLP (1 Reply)
Discussion started by: blp001
1 Replies

2. UNIX for Dummies Questions & Answers

Need to log http requests

Hi folks, I am trying to build this GUI application that will perform some http requests to a specific server. Basically I will use curl to "pretend" that it is a browser a sending an http request from a form. My http knowledge is very low, and the site is tricky, but I think if I could... (3 Replies)
Discussion started by: fundidor
3 Replies

3. Forum Support Area for Unregistered Users & Account Problems

Access to https://www.unix.com/source?

Folks, Hope this is not a newbie question, but it might end up being that. I wanted to retrieve the source code for unix_linux_bench as directed on https://www.unix.com/linux-benchmarks/11175-instructions-linux-benchmarks.html When one clicks on the links specified for download, the browser... (1 Reply)
Discussion started by: wagdalule
1 Replies

4. Solaris

what is the difference between http & Tomcat web server

I do not know the difference between the apache-http and the apche-Tomcat.Is they are differentiated on their version or on their features.:confused: (2 Replies)
Discussion started by: jayaprakash
2 Replies

5. Programming

sending http url through http socket programming..

hi am senthil am developing a software to send and receive SMS using HTTP connection first of all am forming a URL and sending that URL to a remote server using my Client Program i send that url through Socket(using Send() Function) if i send more than one URL one by one using the same... (0 Replies)
Discussion started by: senkerth
0 Replies

6. Shell Programming and Scripting

sending http url through http socket programming..

hi am senthil am developing a software to send and receive SMS using HTTP connection first of all am forming a URL and sending that URL to a remote server using my Client Program i send that url through Socket(using Send() Function) if i send more than one URL one by one using the same... (4 Replies)
Discussion started by: senkerth
4 Replies

7. OS X (Apple)

HbbTV client for OS X or Linux? Access via HTTP possible?

Hi Is there a HbbTV client for OS X or Linux? Access via HTTP possible? https://en.wikipedia.org/wiki/Hybrid_Broadcast_Broadband_TV (0 Replies)
Discussion started by: slashdotweenie
0 Replies

8. Shell Programming and Scripting

A script needs to be created to collect all HTTP GET requests containing a particular string

Hi friends, A script needs to be created to collect all HTTP GET requests containing a particular string say abcd.gif in the url path along with the IP address of the client that issued the request. The source of this data is the web server logs. Also Each script execution should extract... (4 Replies)
Discussion started by: skumar391
4 Replies

9. Web Development

HTTP Headers Reference: HTTP Status-Codes

Hypertext Transfer Protocol -- HTTP/1.1 for Reference - HTTP Headers 10 Status Code Definitions Each Status-Code is described below, including a description of which method(s) it can follow and any metainformation required in the response. (1 Reply)
Discussion started by: Neo
1 Replies

10. Programming

Java HTTP PUT Request/JSON Not Working But Using Python It Does ?

I have some code that I have been playing around with learning Java: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; ... (1 Reply)
Discussion started by: metallica1973
1 Replies
Rotate(3pm)						User Contributed Perl Documentation					       Rotate(3pm)

NAME
Log::Agent::Rotate - parameters for logfile rotation SYNOPSIS
require Log::Agent::Rotate; my $policy = Log::Agent::Rotate->make( -backlog => 7, -unzipped => 2, -is_alone => 0, -max_size => 100_000, -max_time => "1w", -file_perm => 0666 ); DESCRIPTION
The "Log::Agent::Rotate" class holds the parameters describing the logfile rotation policy, and is meant to be supplied to instances of "Log::Agent::Driver::File" via arguments in the creation routine, such as "-rotate", or by using array references as values in the "-channels" hashref: See complementary information in Log::Agent::Driver::File. As rotation cycles are performed, the current logfile is renamed, and possibly compressed, until the maximum backlog is reached, at which time files are deleted. Assuming a backlog of 5 and that the latest 2 files are not compressed, the following files can be present on the filesystem: logfile # the current logfile logfile.0 # most recently renamed logfile logfile.1 logfile.2.gz logfile.3.gz logfile.4.gz # oldest logfile, unlinked next cycle The following switches are available to the creation routine make(), listed in alphabetical order, all taking a single integer value as argument: backlog The total amount of old logfiles to keep, besides the current logfile. Defaults to 7. file_perm The file permissions, given as an octal integer value, to supply to sysopen() during file creation. This value is modified during execution by the umask of the process. In most cases, it is good practice to leave this set to the default and let the user process controll the file permissions. Defaults to 0666. is_alone The argument is a boolean stating whether the program writing to the logfile will be the only one or not. This is a hint that drives some optimizations, but it is up to the program to guarantee that noone else will be able to write to or unlink the current logfile when set to true. Defaults to false. max_size The maximum logfile size. This is a threshold, which will cause a logfile rotation cycle to be performed, when crossed after a write to the file. If set to 0, this threshold is not checked. Defaults to 1 megabyte. max_time The maximum time in seconds between the moment we opened the file and the next rotation cycle occurs. This threshold is only checked after a write to the file. The value can also be given as a string, postfixed by one of the following letters to specify the period unit (e.g. "3w"): Letter Unit ------ ------- m minutes h hours d days d days w weeks M months (30 days of 24 hours) y years Defaults to 0, meaning it is not checked. max_write The maximum amount of data we can write to the logfile. Like "max_size", this is a threshold, which is only checked after a write to the logfile. This is not the total logfile size: if several programs write to the same logfile and "max_size" is not used, then the logfiles may never be rotated at all if none of the programs write at least "max_write" bytes to the logfile before exiting. Defaults to 0, meaning it is not checked. single_host The argument is a boolean stating whether the access to the logfiles will be made from one single host or not. This is a hint that drives some optimizations, but it is up to the program to guarantee that it is accurately set. Defaults to false, which is always a safe value. unzipped The amount of old logfiles, amongst the most recent ones, that should not be compressed but be kept as plain files. Defaults to 1. To test whether two configurations are strictly identical, use is_same(), as in: print "identical " if $x->is_same($y); where both $x and $y are "Log::Agent::Rotate" objects. All the aforementioned switches also have a corresponding querying routine that can be issued on instances of the class to get their value. It is not possible to modify those attributes. For instance: my $x = Log::Agent::Rotate->make(...); my $mwrite = $x->max_write(); would get the configured max_write threshold. AUTHORS
Originally written by Raphael Manfredi <Raphael_Manfredi@pobox.com>, currently maintained by Mark Rogaski <mrogaski@cpan.org>. Thanks to Chris Meshkin for his suggestions on file permissions. SEE ALSO
Log::Agent(3), Log::Agent::Driver::File(3), Log::Agent::Rotate::File(3). perl v5.10.0 2002-05-14 Rotate(3pm)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy