Grep a log file for the last 5 minutes of contents every 5 minutes
Hi all,
System Ubuntu 16.04.3 LTS
i have the following log
i need to create a monitor for this log and grep only last 5 minutes of this log HTTP/1.0" 500 2042, and make an action if the match count is higher then 5 in last 5 minutes.
I tyied the following script but for some reason i can't get it working
The error i gues is with grep because there are the " in the middle.
Could somebody help me on this what i'm i missing here?
Thank you in advance.
I need to know if anyone can assist me on how to grab the last (we'll just say "x" minutes) of a log file. How do you tell the grep command without specifying an exact window of time? (So relative instead of absolute.)
Thanks,
Jon (2 Replies)
Dear Guru's
I've a requirment to grep for a string in series of log files that are getting generated almost every minute.
I'm looking to schedule a script every 15 mountes,in order to check if the error string has been generated in any of the log files generated in last 15 minutes.
Please... (3 Replies)
Hi All,
Below script will make a copy of the existing log file with the then timestamp details.
I am looking to create a copy of the existing log file for every 60 minutes and when the file limit reaches to 5, the 6th copy should overwrite the first backedup file which means all the time it... (3 Replies)
I have below command, which i use for checking last two hours log file, but i want to check 30 minutes log and discard old log, only match current time with last 30 minutes. Command i am using. This below attach log file format is for this week, but sometime it got change in time of log, so i need... (6 Replies)
I have a log file with the below contents :
log_file_updated.txt :
Jul 5 03:33:06 rsyslogd: was
Jul 5 03:33:09 adcsdb1 rhsmd: This system is registered.
Sep 2 02:45:48 adcsdb1 UDSAgent: 2015-07-05 04:24:48.959 INFO Worker_Thread_4032813936 Accepted connection from host <unknown>... (3 Replies)
I have newbie,
which i use for checking last one hours log file,
but i want to check 2 minutes log and discard old log, only match current time with last 2 minutes.
Ex log.
2018-07-03 20:09:17
2018-07-03 20:05:17
2018-07-03 20:05:18
2018-07-03 20:05:20
2018-07-03 20:06:22
2018-07-03... (5 Replies)
Hi, please help with below time conversion to minutes.
one column values:
2 minutes 16 seconds 420 msec
43 seconds 750 msec
0 days 3 hours 29 minutes 58 seconds 480 msec
11 seconds 150 msec
I need output in minutes(total elapsed time in minutes) (2 Replies)
Hello all,
Info:
System RedHat 7.5
I need to create a script that based on the creation time,
if the file is older then 5 minutes then execute some stuff, if not exit.
I thought to get the creation time and minutes like this.
CreationTime=$(stat -c %y /tmp/test.log | awk -F" " '{ print... (3 Replies)
Hi Guys,
I am writing a bash script to capture the last 30 minutes's contents from log file to a new file. This job is a scheduled job and will run every 30 minutes. The log file is db2diag.log in DB2. I am having difficulties copying the last 30 minutes's contents. Can someone please help me.... (4 Replies)
Discussion started by: naveed
4 Replies
LEARN ABOUT OSX
http::request
HTTP::Request(3) User Contributed Perl Documentation HTTP::Request(3)NAME
HTTP::Request - HTTP style request message
SYNOPSIS
require HTTP::Request;
$request = HTTP::Request->new(GET => 'http://www.example.com/');
and usually used like this:
$ua = LWP::UserAgent->new;
$response = $ua->request($request);
DESCRIPTION
"HTTP::Request" is a class encapsulating HTTP style requests, consisting of a request line, some headers, and a content body. Note that the
LWP library uses HTTP style requests even for non-HTTP protocols. Instances of this class are usually passed to the request() method of an
"LWP::UserAgent" object.
"HTTP::Request" is a subclass of "HTTP::Message" and therefore inherits its methods. The following additional methods are available:
$r = HTTP::Request->new( $method, $uri )
$r = HTTP::Request->new( $method, $uri, $header )
$r = HTTP::Request->new( $method, $uri, $header, $content )
Constructs a new "HTTP::Request" object describing a request on the object $uri using method $method. The $method argument must be a
string. The $uri argument can be either a string, or a reference to a "URI" object. The optional $header argument should be a
reference to an "HTTP::Headers" object or a plain array reference of key/value pairs. The optional $content argument should be a
string of bytes.
$r = HTTP::Request->parse( $str )
This constructs a new request object by parsing the given string.
$r->method
$r->method( $val )
This is used to get/set the method attribute. The method should be a short string like "GET", "HEAD", "PUT" or "POST".
$r->uri
$r->uri( $val )
This is used to get/set the uri attribute. The $val can be a reference to a URI object or a plain string. If a string is given, then
it should be parseable as an absolute URI.
$r->header( $field )
$r->header( $field => $value )
This is used to get/set header values and it is inherited from "HTTP::Headers" via "HTTP::Message". See HTTP::Headers for details and
other similar methods that can be used to access the headers.
$r->accept_decodable
This will set the "Accept-Encoding" header to the list of encodings that decoded_content() can decode.
$r->content
$r->content( $bytes )
This is used to get/set the content and it is inherited from the "HTTP::Message" base class. See HTTP::Message for details and other
methods that can be used to access the content.
Note that the content should be a string of bytes. Strings in perl can contain characters outside the range of a byte. The "Encode"
module can be used to turn such strings into a string of bytes.
$r->as_string
$r->as_string( $eol )
Method returning a textual representation of the request.
SEE ALSO
HTTP::Headers, HTTP::Message, HTTP::Request::Common, HTTP::Response
COPYRIGHT
Copyright 1995-2004 Gisle Aas.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.16.2 2012-02-15 HTTP::Request(3)