Write Log per hour


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Write Log per hour
# 1  
Old 02-19-2013
Write Log per hour

Hi, the follow can add the day time to my Log file
My_Log_$(date +%F).log
can I add the hour to the end of my log file then my log file will looks like
My_Log_07-24SmilieSmilie
# 2  
Old 02-19-2013
Try
Code:
%H

at the end
This User Gave Thanks to Vikram_Tanwar12 For This Post:
# 3  
Old 02-19-2013
Smilie
Code:
man date

Smilie
...
...
Smilie
Code:
date +%H-%M

Smilie
These 2 Users Gave Thanks to MadeInGermany For This Post:
# 4  
Old 02-20-2013
Thanks allSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Write whatever error in log file

Hi all, I have export LOG_FILE=$HOME_DIR/error.log sqlplus -s /nolog << EOF whenever sqlerror exit sql.sqlcode @$HOME_DIR/connect.sql whenever sqlerror exit sql.sqlcode @$SQL_FILE EOF can display the sql error in putty, how can I write them into log file ?:( (2 Replies)
Discussion started by: Hscript
2 Replies

2. Shell Programming and Scripting

Grep in a log file within a time range (hour)

Hi, im trying to write a grep script that returns me the last inputs added in the last hour in the log file. Literally i have nothing yet but: grep 'Line im looking for' LOGFILE.log | tail -1 this only gives me the last input, but no necessarily from the last hour. Help Please. (4 Replies)
Discussion started by: blacksteel1988
4 Replies

3. Shell Programming and Scripting

Pick the last one hour lines from log matching this pattern.

Hello please help me on this, pick the last one hour lines from the log, which have the prefix time format like this. log message log message i tried to do grep, but that failed. my code grep '(date +)' log_file_path This checking only the current time stamp. How to get the log... (16 Replies)
Discussion started by: santosh2626
16 Replies

4. Shell Programming and Scripting

Pattern from a log within last hour

I want to extract a pattern from a log file within last hour. I am doing grep "pattern" filename | tail -1 It gives the last latest pattern but not within last hour. and if the pattern found in last hour, output success or else failure. (3 Replies)
Discussion started by: santosh2626
3 Replies

5. Shell Programming and Scripting

How to convert 24 hour time to 12 hour timing?

Hi friends, I want to convert 24 hour timing to 12 hour please help me... my data file looks like this.. 13-Nov-2011 13:27:36 15.32044 72.68502 13-Nov-2011 12:08:31 15.31291 72.69807 16-Nov-2011 01:16:54 15.30844 72.74028 15-Nov-2011 20:09:25 15.35096 ... (13 Replies)
Discussion started by: nex_asp
13 Replies

6. Shell Programming and Scripting

Calculate total of log by hour

Hi, Just wondering, is there anyway I can get the total of logs generated by hours ? Let say I have these logs, Sep 23 04:48:43 hsbcufs: NOTICE: realloccg /: file system full Sep 23 04:48:47 hsbcufs: NOTICE: alloc: /: file system full Sep 23 04:48:51 hsbcufs: NOTICE: realloccg /: file... (14 Replies)
Discussion started by: dehetoxic
14 Replies

7. Shell Programming and Scripting

Getting the last hour from a log.

I have a log like this: Jan 26 13:59:41 server2 ntpdate: step time server 91.189.94.4 offset 0.065456 sec Jan 26 13:59:41 server2 ntpd: ntpd 4.2.4p8@1.1612-o Fri Aug 6 22:49:54 UTC 2010 (1) Jan 26 13:59:41 server2 ntpd: precision = 1.000 usec Jan 26 13:59:41 server2 ntpd: ntp_io: estimated max... (2 Replies)
Discussion started by: Jotne
2 Replies

8. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

9. Programming

how to write to Solaris BSM log

I have a C program and want to write messages to a log. BSM is being used for O/S auditing. Can I write my messages to the BSM log? If so, how do I do that? I'm not finding any API's for that. Any URLs, samples, guidance would be appreciated. (0 Replies)
Discussion started by: JDO
0 Replies

10. UNIX for Dummies Questions & Answers

an hour less in 24 hour system

My program: __________________________________ #!/bin/ksh DAY=`date +%y%m%d` H=`date +%H` M=`date +%M` day=`date +%m/%d/%y` let h=$H-1 echo DAY $DAY echo H $H echo M $M echo day $day echo h $h _____________________________________ My result: (3 Replies)
Discussion started by: bobo
3 Replies
Login or Register to Ask a Question