NetTalk Central

Author Topic: Where's the log file?  (Read 6165 times)

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Where's the log file?
« on: April 14, 2012, 02:09:30 AM »
I've ticked "Screen & Disk" on the web server window but I can't find the log file anywhere.
Any hints?

This NTWS was written in: C6.3 and NT5.39

Peter


useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Where's the log file?
« Reply #1 on: April 14, 2012, 04:52:16 AM »
Select WebServer procedure, Extensions, NetWebServer Logging Controls Template
File NetWebLog
Field WEBLOG:DataLine
Log File Var GLO:WebLogName

alternatively you can create your own tps/sql table and use/modify the following code in the same WebServer proc embeds

If web:EnableLogging > 0
  clear(LogQueue)
  LogQueue.Port = Self.Port
  LogQueue.Date = today()
  LogQueue.Time = clock()
  LogQueue.Desc = 'CLOSED by server IP=' & clip(self.packet.FromIP) & ' on socket ' & self.packet.SockID
  Add(LogQueue,1)

  If web:EnableLogging > 1
    self.AddLog(NetWebLog,WEBLOG:DataLine,GLO:WebLogName,LogQueue.Desc,self.packet.FromIP)
  End

  Loop While Records(LogQueue) > 500
    Get(LogQueue,501)
    Delete(LogQueue)
  End
End


I use

Clear(ServerLog)
SER:Port        = Self.Port
SER:Date        = Today()
SER:Time        = Clock()
SER:IPAddress   = self.packet.FromIP
SER:PacketData  = self.packet.binData
Access:ServerLog.Insert()

SER:Packet being a memo so I can get over the table width limitations in Clarion.

Embeds can be things like port 80 object
ThisWebServer.CloseServerConnection
ThisWebServer.ConnectionClosed
ThisWebServer.Processed
ThisWebServer._MakeErrorPacket

port 443 object
ThisSecureWebServer.CloseServerConnection
ThisSecureWebServer.ConnectionClosed
ThisSecureWebServer.Processed
ThisSecureWebServer._MakeErrorPacket

You may want to experiment by placing the code on different embeds as I was getting nothing showing up in the log but I could see from the firewall logs that connections were being made to my secure server and I want to log these and cross reference them with my Firewall & IDS systems.





peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Where's the log file?
« Reply #2 on: April 14, 2012, 05:15:20 AM »
Hi Mr. Anonymous,

Thanks for your elaborate answer (which is by no means "useless").

However, I was under the impression that you could simply check the field "Screen & Disk"  and get a log file similar to what you see in the monitor window. But it doesn't seem to work.

Peter

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Where's the log file?
« Reply #3 on: April 14, 2012, 12:58:10 PM »
Bruce would need to chip about the screen control options not logging, but I should clarify my above comment becuase its not clear what I was trying to state: "You may want to experiment by placing the code on different embeds as I was getting nothing showing up in the log but I could see from the firewall logs that connections were being made to my secure server and I want to log these and cross reference them with my Firewall & IDS systems."

Firstly the 2 code examples posted 1st being Bruce's code and 2nd being my adaptation works fine in the embeds I have mentioned, the reason I needed to log everything coming in and going out was because my firewall logs were showing requests coming in to the webserver on port 443 but nothing was showing in the listbox webserver window which is why I use the embed code to log everything. I can then cross check the TPS logs against my firewall/IDS logs automatically. Its for piece of mind.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Where's the log file?
« Reply #4 on: April 14, 2012, 11:19:25 PM »
Hi Peter,

Set the file settings on the extension, as Richard explained.
Example 48 (Tagging) has an example log file in the dictionary, and an example global variable for the file name.

Then run the exe, make sure to select the radio option "screen and disk" and do some requests. You'll see the log file in the apps \log folder. (not \web\log).

With regard to Richards other suggestions, with regard to embed code, that has to do with logging other events, other than just requests. He speciafically wanted to see "connections" opening and closing, and also illegal requests (which are not passed to the handler.) Because he could see these in his firewall logs, he wanted to see if they were getting to the server.

In the 6.28 build of the Tagging example, I've added embed code to the WebServer to show this sort of logging as well.

Be aware that logging to disk can easily consume your available disk space, unless you take steps to keep the volume of log history under control.

Cheers
Bruce