• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

how to pull data from a log file??

OutHouse

Lifer
i need to run numbers on two servers that has a app running on it that takes analog calls from devices we have out in the wild. I want to see if there the calls are balanced between the two servers. the file is just a .txt file so how can i pull this data?

 
There are an infinite number of ways to do what you want.

What platform are you using? What tools do you already have available that can do data parsing/crunching?
 
I have no idea what you are looking for in your file, but the basic way to get this accomplished is to read the file line by line until you find a line that indicates a successful call and just keep track of that for each server. Like I said before there are infinite amounts of ways to do this. A very simple shell script, perl script, VB Script, or even Excel could be used to do what you want.

The trick is in finding the pattern of text in the file that indicates an accepted/successful call and then counting the number of times that pattern shows up in the file.
 
Originally posted by: Crusty
I have no idea what you are looking for in your file, but the basic way to get this accomplished is to read the file line by line until you find a line that indicates a successful call and just keep track of that for each server. Like I said before there are infinite amounts of ways to do this. A very simple shell script, perl script, VB Script, or even Excel could be used to do what you want.

The trick is in finding the pattern of text in the file that indicates an accepted/successful call and then counting the number of times that pattern shows up in the file.

That's the way I would do it as well.
 
umm im talking thousands of calls per day. how can i parse the log file just for a successful call. here is an example of a successful call being closed.

2009-10-27 11:54:39 6|DISCONNECT: Closing Port...... {LL1}


the 6 just before disconnect is the port number of the modem taking the call...

 
Sub WriteDisconnect()
Dim TextLine As String, FileName
Dim FileInput As Integer
Dim FileOutput As Integer

FileInput = FreeFile
Open "c:\Source.txt" For Input As #FileInput
FileOutput = FreeFile
Open "c:\Destination.txt" For Output As #FileOutput


Do While Not EOF(FileInput)
Line Input #FileInput, TextLine
If InStr(1, TextLine, "DISCONNECT:") > 0 Then
Print #FileOutput, TextLine
End If
Loop

Close #FileInput
Close #FileOutput
End Sub


That code above opens an input file, populates a string from the input file, and checks to see if "DISCONNECT:" exists in the string. If it does, it writes that line to an output file. You'd have to copy/paste the code into the vba editor in excel to run it.
 
Originally posted by: OutHouse
thank you Klin!

ok im no programmer and i have excel open where is the vba editor? im running excel 2007

1. alt-F11 opens the vba editor
2. double click where it says "Sheet1(sheet1)"
3. paste the code into the white screen
4. The code will be looking for c:\source.txt as the input. You can change it if you want.
5. Go back to excel.
6. Click the view ribbon menu, then macros on the very right.
7. highlight sheet1.writedisconnect and tell it to run.
8. go look for a file called c:\destination.txt
 
cat log.txt | grep "Closing Port" > closed.txt

or you can be more sophisticated with regular expressions, sed, awk, etc...

if you don't have the power of linux then you can get cygwin.
 
Code:
 cat * |grep " |DISCONNECT: Closing Port" | wc -l

Will give you a count of all lines matching that string for all of the files in current directory.
 
Back
Top