Discussion:
how to see what users are searching
(too old to reply)
r***@gmail.com
2007-03-05 17:09:46 UTC
Permalink
Hello to all
in my web server as you know i run iis; the log file is in the w3c
format.
I'd like to see what people search.
in these log files, i can see what document they open as a result of
query but I cannot see what the type in the search box;
i can read that they post all the time my idq file and after they get
a document, but i cannot what they typed in the search box
(userresctiction)

Is there any way to log the search query?
tnx in advance
all the time
Roberto Gerlando
Don Grover
2007-03-05 21:36:03 UTC
Permalink
I just write to a text file re below asp sub:
strLogFileName = CStr("Remote Access." & Year(Date) & ".log")
'enter your preferred file name here

'Make a entry in the log
WriteToLog Request.ServerVariables("REMOTE_ADDR") & " " & "Search log files
Catalog: " & sCatalog & " Searching For: " & sSearchString


<%
'Specific Write to Logfile & close , cleanup Sub
Sub WriteToLog(strNewEntry)
Dim objLogFileFSO, objLogFileTS, strLogEntry
Set objLogFileFSO = CreateObject("Scripting.FileSystemObject")
If objLogFileFSO.FileExists(strLogFilepath & strLogFileName) Then
Set objLogFileTS = objLogFileFSO.OpenTextFile(strLogFilepath &
strLogFileName, ForAppending)
Else
Set objLogFileTS = objLogFileFSO.CreateTextFile(strLogFilepath &
strLogFileName)
End If
strLogEntry = Request.ServerVariables("SERVER_NAME") & " - " &
Request.ServerVariables("HTTP_X_FORWARDED_FOR") & " - " &
FormatDateTime(Now) & " - "
strLogEntry = strLogEntry & strNewEntry
objLogFileTS.WriteLine strLogEntry
objLogFileTS.Close
Set objLogFileTS = Nothing
Set objLogFileFSO = Nothing
End Sub
%>
Post by r***@gmail.com
Hello to all
in my web server as you know i run iis; the log file is in the w3c
format.
I'd like to see what people search.
in these log files, i can see what document they open as a result of
query but I cannot see what the type in the search box;
i can read that they post all the time my idq file and after they get
a document, but i cannot what they typed in the search box
(userresctiction)
Is there any way to log the search query?
tnx in advance
all the time
Roberto Gerlando
r***@gmail.com
2007-03-06 08:19:58 UTC
Permalink
I'm sorry
I thank you for the answer but I cannot understand it;
is this a code that I should write in my hmtl search page?

Roberto Gerlando
Post by Don Grover
strLogFileName = CStr("Remote Access." & Year(Date) & ".log")
'enter your preferred file name here
'Make a entry in the log
WriteToLog Request.ServerVariables("REMOTE_ADDR") & " " & "Search log files
Catalog: " & sCatalog & " Searching For: " & sSearchString
<%
'Specific Write to Logfile & close , cleanup Sub
Sub WriteToLog(strNewEntry)
Dim objLogFileFSO, objLogFileTS, strLogEntry
Set objLogFileFSO = CreateObject("Scripting.FileSystemObject")
If objLogFileFSO.FileExists(strLogFilepath & strLogFileName) Then
Set objLogFileTS = objLogFileFSO.OpenTextFile(strLogFilepath &
strLogFileName, ForAppending)
Else
Set objLogFileTS = objLogFileFSO.CreateTextFile(strLogFilepath &
strLogFileName)
End If
strLogEntry = Request.ServerVariables("SERVER_NAME") & " - " &
Request.ServerVariables("HTTP_X_FORWARDED_FOR") & " - " &
FormatDateTime(Now) & " - "
strLogEntry = strLogEntry & strNewEntry
objLogFileTS.WriteLine strLogEntry
objLogFileTS.Close
Set objLogFileTS = Nothing
Set objLogFileFSO = Nothing
End Sub
%>
Post by r***@gmail.com
Hello to all
in my web server as you know i run iis; the log file is in the w3c
format.
I'd like to see what people search.
in these log files, i can see what document they open as a result of
query but I cannot see what the type in the search box;
i can read that they post all the time my idq file and after they get
a document, but i cannot what they typed in the search box
(userresctiction)
Is there any way to log the search query?
tnx in advance
all the time
RobertoGerlando- Nascondi testo tra virgolette -
- Mostra testo tra virgolette -
Gang_Warily
2007-03-06 16:53:13 UTC
Permalink
You could try using
<form action="something.asp" method="get"><input name=SearchString>
instead of
<form action="something.asp" method="post"><input name=SearchString>
so the query appears in the address bar ?
something.asp?SearchString=words+typed+in

... and in the "cs-uri-query" column of the log files.
There is a limit on the amoint of info you can pass using GET,
and it exposes the workings slightly.

You may have to change 'Request.Form("SearchString")' to
'Request.Querystring("SearchString")' ,
[or just 'Request("SearchString")' which will work either way]
Post by r***@gmail.com
I'm sorry
I thank you for the answer but I cannot understand it;
is this a code that I should write in my hmtl search page?
Roberto Gerlando
Post by Don Grover
strLogFileName = CStr("Remote Access." & Year(Date) & ".log")
'enter your preferred file name here
'Make a entry in the log
WriteToLog Request.ServerVariables("REMOTE_ADDR") & " " & "Search log files
Catalog: " & sCatalog & " Searching For: " & sSearchString
<%
'Specific Write to Logfile & close , cleanup Sub
Sub WriteToLog(strNewEntry)
Dim objLogFileFSO, objLogFileTS, strLogEntry
Set objLogFileFSO = CreateObject("Scripting.FileSystemObject")
If objLogFileFSO.FileExists(strLogFilepath & strLogFileName) Then
Set objLogFileTS = objLogFileFSO.OpenTextFile(strLogFilepath &
strLogFileName, ForAppending)
Else
Set objLogFileTS = objLogFileFSO.CreateTextFile(strLogFilepath &
strLogFileName)
End If
strLogEntry = Request.ServerVariables("SERVER_NAME") & " - " &
Request.ServerVariables("HTTP_X_FORWARDED_FOR") & " - " &
FormatDateTime(Now) & " - "
strLogEntry = strLogEntry & strNewEntry
objLogFileTS.WriteLine strLogEntry
objLogFileTS.Close
Set objLogFileTS = Nothing
Set objLogFileFSO = Nothing
End Sub
%>
Post by r***@gmail.com
Hello to all
in my web server as you know i run iis; the log file is in the w3c
format.
I'd like to see what people search.
in these log files, i can see what document they open as a result of
query but I cannot see what the type in the search box;
i can read that they post all the time my idq file and after they get
a document, but i cannot what they typed in the search box
(userresctiction)
Is there any way to log the search query?
tnx in advance
all the time
RobertoGerlando- Nascondi testo tra virgolette -
- Mostra testo tra virgolette -
r***@gmail.com
2007-03-06 18:49:24 UTC
Permalink
I used the get instead the post method but the log is not clear to
understand;
i'd like to do a form with double action;
the first action should pass the words typed in for the query
the second action should pass the words typed in on a txt file.

Any ideas?

Regards
Roberto Gerlando
Gang_Warily
2007-03-07 10:51:07 UTC
Permalink
That sounds more like Don Grover's answer above.
You'll need to supply a value for the variable strLogFilepath.
Request.ServerVariables("HTTP_X_FORWARDED_FOR") may not exist if access
isn't via a proxy server - not sure if that gives an error or a zero-length
string ...

Are you OK combining his script in your search results code ?

Alternatively, www.logparser.com supports a wonderful free Microsoft tool
that will help you extract the bit you want from your IIS logfile using a SQL
query.
It also takes a bit of learning, but is very powerful:
you could correlate search words and resulting pages viewed,
or generate bar-charts directly from the logfiles (if you have MS Office).
The forum there is very helpful.

Good luck !
Eric
Post by r***@gmail.com
I used the get instead the post method but the log is not clear to
understand;
i'd like to do a form with double action;
the first action should pass the words typed in for the query
the second action should pass the words typed in on a txt file.
Any ideas?
Regards
Roberto Gerlando
Gang_Warily
2007-03-07 11:09:18 UTC
Permalink
PS
Just noticed you say
"is this a code that I should write in my hmtl search page?":
are you using an .IDQ file instead of .ASP ?
That would need changing, I think !

If you're just learning ASP, the IIS Logfile way might be simplest.
If you're curious about searches, you will probably want to analyse use as
well ?

There are plenty of programs that will help analyse logs,
but analysing the querystring "cs-uri-query" is a secondary function that
may not work well in some programs - good ones aren't cheap
http://www.freedownloadscenter.com/Network_and_Internet/Web_Server_Statistics_Tools/
http://www.iisfaq.com/Default.aspx?tabid=2518
http://www.serverwatch.com/tutorials/article.php/3518061

I find LogParser is worth learning.
Post by r***@gmail.com
I used the get instead the post method but the log is not clear to
understand;
i'd like to do a form with double action;
the first action should pass the words typed in for the query
the second action should pass the words typed in on a txt file.
Any ideas?
Regards
Roberto Gerlando
r***@gmail.com
2007-03-14 10:12:32 UTC
Permalink
I use idq files
Gang_Warily
2007-03-14 12:09:03 UTC
Permalink
Ah - unfortunately, I think IDQ can only do one thing - search results pages:
ASP is much more flexible.

There are ready-made ASP solutions out there:
I believe Windows 2000 came with example pages.
www.indexserverfaq.com/classicasp.zip
http://ixsf.sourceforge.net/ - free
www.simongibson.com £15
If you search software download sites you may find one with search word
logging ?
You could try dropping Don Grover's code into one of the above.

But learning ASP will take a while.
Using LogParser on the IIS logfiles may be simpler.
Even Excel can be useful for examining logfiles ...

Eric
Post by r***@gmail.com
I use idq files
Loading...