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 302977059 by Chubler_XL on Monday 11th of July 2016 11:16:06 PM
Old 07-12-2016
If you have gnu awk available you could use mktime() like this:

Code:
gawk '
/PUT/||/DELETE/{
   file=$5;
   gsub(".*/", "", file)
   stamp=$1 " " $2
   gsub("[:-]", " ", stamp)
}
/PUT/ {
   w[file]=mktime(stamp)
}
/DELETE/ && (file in w) {
   print "File: " file ", difference: " mktime(stamp) - w[file] "sec"
   delete w[file]
}' infile

Output for demo file:

Code:
File: file_30.txt, difference: 21sec
File: file_31.txt, difference: 21sec

This User Gave Thanks to Chubler_XL 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
HTTP::OAI::UserAgent(3pm)				User Contributed Perl Documentation				 HTTP::OAI::UserAgent(3pm)

NAME
HTTP::OAI::UserAgent - Extension of the LWP::UserAgent for OAI HTTP requests DESCRIPTION
This module provides a simplified mechanism for making requests to an OAI repository, using the existing LWP::UserAgent module. SYNOPSIS
require HTTP::OAI::UserAgent; my $ua = new HTTP::OAI::UserAgent; my $response = $ua->request( baseURL=>'http://arXiv.org/oai1', verb=>'ListRecords', from=>'2001-08-01', until=>'2001-08-31' ); print $response->content; METHODS
$ua = new HTTP::OAI::UserAgent(proxy=>'www-cache',...) This constructor method returns a new instance of a HTTP::OAI::UserAgent module. All arguments are passed to the LWP::UserAgent constructor. $r = $ua->request($req) Requests the HTTP response defined by $req, which is a HTTP::Request object. $r = $ua->request(baseURL=>$baseref, verb=>$verb, %opts) Makes an HTTP request to the given OAI server (baseURL) with OAI arguments. Returns an HTTP::Response object. OAI-PMH related options: from => $from until => $until resumptionToken => $token metadataPrefix => $mdp set => $set $str = $ua->url(baseURL=>$baseref, verb=>$verb, ...) Takes the same arguments as request, but returns the URL that would be requested. $time_d = $ua->delay( $time_d ) Return and optionally set a time (in seconds) to wait between requests. $time_d may be a CODEREF. perl v5.12.4 2011-06-23 HTTP::OAI::UserAgent(3pm)
All times are GMT -4. The time now is 08:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy