This thread is archived
87 Replies Last post: Aug 2, 2006 11:40 AM by evan swendsen  
Jeffery A. Stout   35 posts since
Apr 15, 2005
Currently Being Moderated

May 25, 2005 1:23 PM

Logging Conversations

I have setup the server to log conversations between users in a corporate environment. But the log file has a lot of stuff that I really don''t need and it is difficult to navigate when looking for a specific item. Is there an app I can use to read the file easier or a plugin I can use to save them as a plain text conversation?

 

ItsNewToYou

Josh Bronze 31 posts since
Nov 30, 2004
Currently Being Moderated
May 26, 2005 10:51 AM in response to: Jeffery A. Stout
Re: Logging Conversations

I''d also be interested in a feature like this if it isn''t available.  I''m doing some searches for an XML parser app that I can use in the meantime.

Ryan Graham KeyContributor 1,790 posts since
Jan 17, 2003
Currently Being Moderated
May 26, 2005 11:15 AM in response to: Jeffery A. Stout
Re: Logging Conversations

There''s been some discussion before about how to improve logging and auditing (here''s one url=http://www.jivesoftware.org/forums/thread.jspa?threadID=14432thread[/url] in particular) but I don''t believe anyone is actively working on anything.

 

Hope that helps,

Ryan

Gaston Dombiak Jiver 3,798 posts since
Sep 26, 2001
Currently Being Moderated
May 26, 2005 2:53 PM in response to: Jeffery A. Stout
Re: Logging Conversations

Hey ItsNewToYou,

 

There aren''t any tools for it yet, but we do hope to add some ways to view/search it in the admin console in a future release. Meanwhile, if you are logging stuff that you don''t need you can only check to audit Message packets and leave unchecked IQ and Presence packets in the Admin Console.

 

Regards,

 

  -- Gato

Jason McClean   69 posts since
Nov 29, 2004
Currently Being Moderated
Jun 2, 2005 3:29 AM in response to: Jeffery A. Stout
Re: Logging Conversations

I''ve been doing a little work on this.

 

I''ve put together a small Perl script that parses the jive.audit log files and creates dated log files from them (default is the current date but an offset in days can be passed in). This could be run as a cron job (or scheduled task) early in the morning, specifying an offset of -1 to grab all the previous day''s traffic.  All log files are parsed as there is no accounting for preferred rollover file sizes and also depending on heavy usage, a single day''s traffic could span several files.  The original log files remain intact.

 

I have submitted a feature request to have the facility to specify log rollover by time rather than by file size and Matt has kindly filed it as JM-298, so the Perl script would eventually become redundant.

 

I then have a program in C#  - .NET but I''m sure it can be ported to Mono,  (I''m all over the place with languages , except Java ) that parses the dated log file, although it can quite happily parse the original audit file as the only difference being the dated log files only contain message packets for a specific date. I''ve not tested very large files.

 

Messages are presented in the form of a list, giving date, sender, message type (chat or message), subject and first 20 words of message body.  Double clicking will provide the whole message.  This list can then be filtered by senders and message type, i.e. being able to focus in on a chat, or just view all messages sent by a particular user.

 

As message packets are logged twice, ie. from the sender''s stream and also to the recipient''s stream, these are ignored based on sender, subject (if one exists), and message body.  Recipient is ignored to allow for broadcast messages.

 

I could post the code if anyone is interested, but bear in mind that I tend to take extreme programming to extremes and just omit design completely . Currently there are no configuration options so lots of stuff is hard coded, but I could fix that before posting.  Also none this is internationalised in terms of date/time formats, but again, date formatting could be set as an option.

 

Things to do:

Stuff this all into a database to allow for easy searching, and add a liberal sprinkling of nice icons.

 

Cheers,

 

Jason.

Matt Tucker Jiver 3,153 posts since
Jun 28, 2001
Currently Being Moderated
Jun 2, 2005 11:43 AM in response to: Jason McClean
Re: Logging Conversations

Jason,

 

Sounds cool. I''ve given you permission to post attachments in case you want to attach your app or screenshots.

 

Regards,

Matt

Jason McClean   69 posts since
Nov 29, 2004
Currently Being Moderated
Jun 3, 2005 5:08 AM in response to: Matt Tucker
Re: Logging Conversations

Hi,

 

I''ve attached a png image of the log viewer itself to whet your appetites.  It shows the main points of the application.  Appearance is a little bland at the moment.  No screen shot for the Perl script - no output on stdout (hopefully none on stderr either!).

 

The context menu - Focus this type lets you easily focus in on a chat or a series of messages between two users, without having to set the filter via the filter window.  Focus all types selects all types of message between the two users.  The last one is handy here as lots of users still haven''t got to grips with the difference between chat and message.  The Filter window allows you to select from all available users (that are listed in the log file) and view various types of message between them.

 

For the list of users, the application strips off the domain section of the JID and assumes that if the first portion has a . in it then it is Firstname.Surname and uses proper case on the username (only for display - the original message is stored intact).

 

Currently, the application only reads the dated log file, however, I will get around to enabling this to be entered into a database.

 

I''ll do a little work on putting some of the hard coded settings in the log viewer into some sort of config file to make things easier.  Hopefully being able to post the code in the next few days.

 

Sorry, no smilies in the message window , not yet at least.  I''m using a RichText control and displaying images is a little involved if you want to avoid using the clipboard.

 

I have also attached the Perl script that splits the audit logs into dated files.  This should work on both Windows and Linux, the path separator really being the only difference.

 

The Perl script can take 4 options:

-o specify an offset in days previous to the current day.  I.e -o "-1" for yesterday

Default is 0 i.e. today.  I suppose that means you can supply and offset for a future date, but that won''t get you anywhere

 

-O output location for the dated log file

Default is ./logs (I think this works on Windows regardless of the / separator)

 

-l location of the jive audit files

Default is /opt/jive_messenger/logs (no idea where the default is on Windows)

 

-f a template for the audit file

Default is jive.audit-*.log.  The script then ''globs'' all matching files.

 

The output log file is named yyyy-mm-dd.log and is in the same format as the original, just containing the message packets from the specified date.

 

The current BIG assumption in the Perl script is that the message packet dates are  in the form: Fri Jun 02 09:35:00 BST 2005, with BST and GMT being used depending on daylight savings being in effect.  I''m sure someone can point out the error of my ways here.

 

Actually, the Log viewer makes this assumption as well (as that is the format our logs take).

 

Hope this helps a few people.

 

Cheers,

 

Jason.

 

Message was edited by:

        jasonmcclean

Attachments:
Jason McClean   69 posts since
Nov 29, 2004
Currently Being Moderated
Jul 19, 2005 3:39 AM in response to: Jason McClean
Re: Logging Conversations

Ok, turned out there weren''t that many hard coded settings

 

I''ve attached the C# source code.  You will need, at least, the .NET v1.1 SDK to compile.  Much easier if you have something like Visual Studio .Net, or what I use, a GPL .NET IDE called SharpDevelop (http://www.icsharpcode.net/OpenSource/SD/Default.aspx).

 

Create a new project, add in all the source files.  The file called Log Viewer.exe.config should be placed in the output folder and renamed to match the executable that you produce, i.e. yourApp.exe.config.  This file contains the broadcast address, your domain (not used at moment), date/time format for display and the window caption.

 

I can post the executable if you wish, but you will need the .NET v1.1 runtime to run it.

 

The whole thing needs a good polish, but it works.  Let me know when you find all the  bugs.

 

EDIT

Just checking and noticed something.  If you are going to use it on the actual log files produced by Jive messenger, use a copy.  This is because in the current log file, the closing </jive> tag as not yet been added.  The log viewer checks for this and adds it if it can''t be found.  This avoids errors being thrown from the Xml classes being used.  Not sure what impact that would have if Jive Messenger found the closing tag when it wasn''t supposed to be there, unless it just blindly appends to the file.  However, you would then still end up with an invalid XML file at the end due to two closing tags being present.

 

Sorry

 

End of edit

 

Cheers,

 

Jason.

 

Message was edited by:

        jasonmcclean

 

edit

source added to message towards end

Jason McClean   69 posts since
Nov 29, 2004
Currently Being Moderated
Jun 8, 2005 7:50 AM in response to: Jason McClean
Re: Logging Conversations

Any feedback?

 

I''ve added support for emoticons and you can easily recreate psuedo chats from either chats or related messages.

 

I''ll update the previous post with new code if anyone interested.  If not, nevermind, it''s doing what I need

 

Jason.

Jason McClean   69 posts since
Nov 29, 2004
Currently Being Moderated
Jun 8, 2005 10:08 AM in response to: Jason McClean
Re: Logging Conversations

Added image of chat window created from the logs. (couldn''t add it to previous post as it didn''t originally have an attachment).

 

I''ll stop now.

 

Jason.

Attachments:
Matt Tucker Jiver 3,153 posts since
Jun 28, 2001
Currently Being Moderated
Jun 8, 2005 10:28 AM in response to: Jason McClean
Re: Logging Conversations

Jason,

 

It''s starting to look very cool! Would you be interested in doing binary releases so that people can more easily use the software?

 

Regards,

Matt

Jason McClean   69 posts since
Nov 29, 2004
Currently Being Moderated
Jul 19, 2005 3:49 AM in response to: Matt Tucker
Re: Logging Conversations

Would you be

interested in doing binary releases so that people

can more easily use the software?

 

Not a problem.  As long as .NET v1.1 runtime is installed, there shouldn''t be a problem.

 

Have attached binary.

 

Emoticon support was added by using the RichEdit control by Khendys Gordon (http://www.codeproject.com/cs/miscctrl/csexrichtextbox.asp)

 

The emoticons are taken from the Psi client (http://psi.affinix.com) as that is the client we use - using the same icondef.xml as Psi uses.  That means any icon set with a corresponding icondef.xml can be used.

 

Just extract and run.

 

edit

Oh, edit the Log Viewer.exe.config file first with your broadcast address to pick up broadcast messages.  Will work without, but you won''t see broadcasts marked as such, just the first recipient message.

 

Jason.

 

Message was edited by:

        jasonmcclean

edit

Seem to have lost the binary.  Reattached to a message towards the end.

Brett A   7 posts since
Jun 16, 2005
Currently Being Moderated
Jun 16, 2005 3:39 PM in response to: Jason McClean
Re: Logging Conversations

Just wanted to thank you all for your efforts in doing this work... especially the spiffy log reader!

Nata   13 posts since
Jul 12, 2005
Currently Being Moderated
Jul 13, 2005 7:29 AM in response to: Jason McClean
Re: Logging Conversations

Hi!

 

I am trying to use the LogViewer, but in both scenarios (source and bin) I get the same error when i open the log file:

 

==========================================

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.

 

                            • Exception Text **************

System.NullReferenceException: Object reference not set to an instance of an object.

   at Listawood.Xmpp.LogViewer.XmppLog.Add(XmlNode value) in c:\Documents and Settings\nromero\My Documents\SharpDevelop Projects\LogViewer\XmppLog.cs:line 55

   at Listawood.Xmpp.LogViewer.MainForm.LoadFile(String fileName) in c:\Documents and Settings\nromero\My Documents\SharpDevelop Projects\LogViewer\MainForm.cs:line 413

   at Listawood.Xmpp.LogViewer.MainForm.OpenLogFile() in c:\Documents and Settings\nromero\My Documents\SharpDevelop Projects\LogViewer\MainForm.cs:line 281

   at Listawood.Xmpp.LogViewer.MainForm.MainToolBarButtonClick(Object sender, ToolBarButtonClickEventArgs e) in c:\Documents and Settings\nromero\My Documents\SharpDevelop Projects\LogViewer\MainForm.cs:line 235

   at System.Windows.Forms.ToolBar.OnButtonClick(ToolBarButtonClickEventArgs e)

   at System.Windows.Forms.ToolBar.WmReflectCommand(Message& m)

   at System.Windows.Forms.ToolBar.WndProc(Message& m)

   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

 

                            • Loaded Assemblies **************

mscorlib

    Assembly Version: 1.0.5000.0

    Win32 Version: 1.1.4322.573

    CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll

-


LogViewer

    Assembly Version: 1.0.2020.24043

    Win32 Version: 1.0.2020.24043

    CodeBase: file:///C:/Documents%20and%20Settings/nromero/My%20Documents/SharpDevelop%20Pro jects/LogViewer/bin/Debug/LogViewer.exe

-


System.Windows.Forms

    Assembly Version: 1.0.5000.0

    Win32 Version: 1.1.4322.573

    CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e0 89/system.windows.forms.dll

-


System

    Assembly Version: 1.0.5000.0

    Win32 Version: 1.1.4322.573

    CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll

-


System.Drawing

    Assembly Version: 1.0.5000.0

    Win32 Version: 1.1.4322.573

    CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/sys tem.drawing.dll

-


System.Xml

    Assembly Version: 1.0.5000.0

    Win32 Version: 1.1.4322.573

    CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system. xml.dll

-


 

                            • JIT Debugging **************

To enable just in time (JIT) debugging, the config file for this

application or machine (machine.config) must have the

jitDebugging value set in the system.windows.forms section.

The application must also be compiled with debugging

enabled.

 

For example:

 

 

When JIT debugging is enabled, any unhandled exception

will be sent to the JIT debugger registered on the machine

rather than being handled by this dialog.

=================================================

 

What am I missing?

 

thanks!

Jason McClean   69 posts since
Nov 29, 2004
Currently Being Moderated
Jul 13, 2005 10:54 AM in response to: Nata
Re: Logging Conversations

I''m guessing that there is a problem with the XML, so the XML classes are not happy.  Are you accessing the raw log file or using the Perl script to extract specific dates from the raw log file, then accessing the file that the Perl script creates?

 

If it is the raw log file, then maybe the bit of code I shoved in to add the missing </jive> tag isn''t working. I''ll have a play about tomorrow and get back to you.  Unfortunately no time at the moment.

 

Jason.

Jason McClean   69 posts since
Nov 29, 2004
Currently Being Moderated
Jul 13, 2005 11:01 AM in response to: Jason McClean
Re: Logging Conversations

Nope, it''s not that.  Just taken a file and removed the </jive> tag from it and everything still worked.  opened the file up in notepad after and the </jive> was back again, so that is definitely working.

 

Hmm, if you are using the raw log file, do you have write access to it?

 

edit

Unfortunately, as I just threw this together for internal use I didn''t put in a lot of error checking code - darn, remember that next time I release code on the unsuspecting world.

 

Message was edited by:

        jasonmcclean

Nata   13 posts since
Jul 12, 2005
Currently Being Moderated
Jul 13, 2005 12:27 PM