give me a shell-script which extract data from log file on a server by giving date and time as input (for both start time and end time) and it will give the logs generated during the given time as output. (4 Replies)
Hello All,
I just need to extract the date portion from a apache log file
I am able to do it using the chain of command -
Logfile contents - First record -
==========================
197.130.211.240 - - "GET /jp/index.shtml HTTP/1.1" 200 24255... (4 Replies)
Hi , I am having a script which will start a process and appends the process related logs to a log file. The log file writes logs with every line starting with date in the format of: date +"%Y %b %d %H:%M:%S".
So, in the script, before I start the process, I am storing the date as DATE=`date +"%Y... (5 Replies)
Looking for a shell script or a simple perl script . I am new to scripting and not very good at it .
I have 2 directories . One of them holds a text file with list of files in it and the second one is a daily log which shows the file completion time. I need to co-relate both and make a report.
... (0 Replies)
If I have a log like :
Mon Jul 19 05:07:34 2010; TCP; eth3; 52 bytes; from abc to def
Mon Jul 19 05:07:35 2010; UDP; eth3; 46 bytes; from aaa to bbb
Mon Jul 19 05:07:35 2010; TCP; eth3; 52 bytes; from def to ghi
I will need an output like this :
Time abc to def... (1 Reply)
Hi Gurus,
I've been having some problem in extracting the log data based on the current date and month.
As shown in the sample data below, how to extract the log info for Aug 11?
Sample data:
root pts/ta userpc Wed Aug 11 09:46 - 20:21 (10:35)
root pts/ta userpc... (13 Replies)
Please help me out to extract the Data from the XML Log files.
So here is the data
ERROR|2010-08-26 00:05:52,958|SERIAL_ID=128279996|ST=2010-08-2600:05:52|DEVICE=113.2.21.12:601|TYPE=TransactionLog... (9 Replies)
Hi Gurus,
I'm using HP-UX B.11.23 operating system.
I've been trying to extract this log info based on the current date and month, but was having some issues as the date column which on the 4th column has a comma and the 5th column has a dot tied to it.
Here is the output from my shut... (5 Replies)
I was searching for parsing a log file and found what I need in this link
http://stackoverflow.com/questions/7575267/extract-data-from-log-file-in-specified-range-of-time
But the most useful answer (posted by @Kent):
# this variable you could customize, important is convert to seconds.
# e.g... (2 Replies)
So, we have a script, that is supposed to have a couple of functions like showing number of failed connections, recieved bytes per IP-address, and so on. We are supposed to be able to limit the number of results to either 0-24 hours or X days back from the last data in the log file.
Everything... (3 Replies)
Discussion started by: Plumpen
3 Replies
LEARN ABOUT PHP
datetime.settime
DATETIME.SETTIME(3) 1 DATETIME.SETTIME(3)DateTime::setTime - Sets the time
Object oriented style
SYNOPSIS
public DateTime DateTime::setTime (int $hour, int $minute, [int $second])
DESCRIPTION
Procedural style
DateTime date_time_set (DateTime $object, int $hour, int $minute, [int $second])
Resets the current time of the DateTime object to a different time.
PARAMETERS
o $object
-Procedural style only: A DateTime object returned by date_create(3). The function modifies this object.
o $hour
- Hour of the time.
o $minute
- Minute of the time.
o $second
- Second of the time.
RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | Changed the return value on success from NULL to |
| | DateTime. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
DateTime.setTime(3) example
Object oriented style
<?php
$date = new DateTime('2001-01-01');
$date->setTime(14, 55);
echo $date->format('Y-m-d H:i:s') . "
";
$date->setTime(14, 55, 24);
echo $date->format('Y-m-d H:i:s') . "
";
?>
Procedural style
<?php
$date = date_create('2001-01-01');
date_time_set($date, 14, 55);
echo date_format($date, 'Y-m-d H:i:s') . "
";
date_time_set($date, 14, 55, 24);
echo date_format($date, 'Y-m-d H:i:s') . "
";
?>
The above examples will output something similar to:
2001-01-01 14:55:00
2001-01-01 14:55:24
Example #2
Values exceeding ranges are added to their parent values
<?php
$date = new DateTime('2001-01-01');
$date->setTime(14, 55, 24);
echo $date->format('Y-m-d H:i:s') . "
";
$date->setTime(14, 55, 65);
echo $date->format('Y-m-d H:i:s') . "
";
$date->setTime(14, 65, 24);
echo $date->format('Y-m-d H:i:s') . "
";
$date->setTime(25, 55, 24);
echo $date->format('Y-m-d H:i:s') . "
";
?>
The above example will output:
2001-01-01 14:55:24
2001-01-01 14:56:05
2001-01-01 15:05:24
2001-01-02 01:55:24
SEE ALSO DateTime.setDate(3), DateTime.setISODate(3).
PHP Documentation Group DATETIME.SETTIME(3)