Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 203622

Summary: Apache Error log static parser does not use timezone specified by user in import dialog
Product: z_Archived Reporter: Dave Smith <smith>
Component: TPTP.monitoringAssignee: Rohit Shetty <rohit.shetty>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P1 CC: apnan, jkubasta, labadie, rohit.shetty
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard: closed460
Attachments:
Description Flags
Patch
none
Updated patch none

Description Dave Smith CLA 2007-09-17 12:57:04 EDT
The log import dialog for the Apache HTTP server error log has a field where the user can specify the timezone that the log file was generated in.  The Apache HTTP server error log record timestamps do not include the timezone. The parsers are supposed to use the timezone value passed by the user to generate the CommonBaseEvent creationTime value.  The Apache HTTP server error log rules parser uses the timezone value but the static parser does not use the timezone value.

To reproduce this problem, do the following:

1) Select File -> Import... -> Profiling and Logging -> Log File.  Click Next.
2) In the Import Log File window, click the Add... button.
3) In the Add Log File window select Apache HTTP Server error log in the Log Types pane.
4) Enter the log file path and select a static version of the server eg. 1.3.20(static), 1.3.26(static), or 2.0(static), in the Log Details tab.
5) Select the appropriate character encoding in the Log Details tab.
6) Select a timezone different than the default system timezone on the system you are importing from.
7) Click OK and then Finish to import the log file.
8) After the log is shown in the Log View, select Windows -> Preferences... -> Profiling and Logging -> Log View.
9) In the Timestamp Format tab select the LONG time format.  Click Apply and then OK.
10) Notice that the timezone in the Creation Time values in the Log View are the current system timezone and not the timezone specified in the log import dialog.
11) Import the same log file but this time specify a rules version of the server in the log import dialog eg. 1.3.x(rules) or 2.0.x(rules).  Notice that the timezone in the Creation Time values in the Log View correctly reflect the timezone specified in the log import dialog.
Comment 1 Dave Smith CLA 2007-09-17 13:23:57 EDT
This is required for 4.5.

To fix this, the "timezone" property needs to be added to the static parser sensor configuration in the Apache HTTP Server error log static.adapter file and the static parser class org.eclipse.hyades.logging.parsers.AbstractErrorLogParser must be changed to get the timezone from the input hash table and use it in the parseDate method when generating the creationTime value of the Common Base Event.  The code should handle the value org.eclipse.hyades.logging.adapter.util.dapterConstants.AttributeValue_Default and use the default system timezone in that case.

I added a sizing of 8 hours to do the coding, unit testing and creating new test cases (JUnit and AGR).
Comment 2 Alex Nan CLA 2007-11-20 09:56:21 EST
Assigning to i4.
Comment 3 Rohit Shetty CLA 2007-11-20 23:47:19 EST
Created attachment 83391 [details]
Patch

Will add test cases as soon as they are done.
Comment 4 Rohit Shetty CLA 2007-11-27 08:47:22 EST
Created attachment 83861 [details]
Updated patch
Comment 5 Alex Nan CLA 2007-11-27 23:27:14 EST
Rohit, the patch is OK now except that I forgot to mention last time  two details, sorry about this:
- put the "timezone" string from 
String timezone = (String)table.get("timezone");
into the ParserConstants as, let's say, 
public final static String TIME_ZONE="timezone"
- add in the header a comment logging your change: committer name and bugzilla.

Once you have done these changes do an additional test and check in the fix. 
Thanks.
Comment 6 Rohit Shetty CLA 2007-11-28 05:08:28 EST
Updated junits and autogui ...

Fixed. In CVS.
Comment 7 Paul Slauenwhite CLA 2009-06-30 09:55:22 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this originator of this enhancement/defect has an inactive Bugzilla account and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.