Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query

Author  Topic 

fatih1579
Starting Member

2 Posts

Posted - 2011-07-29 : 16:59:07
Hello.
We have a log server. we are saving logs in sql server.
I need a query for syslogs. I am not sure is it possible.
param1 = event id
param2 = dates
param3 = ip adress.

I want to search event id 9111.
dates 1 month.
result will be so much. because everydays so much log coming.
I want to see last 10 or 20 result for each ip adress.

last 15-20 log engougf for me.

could I make a query like this?

thanks.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-07-29 : 17:34:28
Yes you can! And with a proper design it will be fast too.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

fatih1579
Starting Member

2 Posts

Posted - 2011-07-29 : 18:07:41
can you help me?
can you make a example me?
" FROM dbo.Events WITH (INDEX(IX_EVents_TimeGenerated_EventID),nolock)"&
" WHERE (EventID = '9105') AND (Source = 'Syslog-Generic') AND TimeGenerated BETWEEN CAST('" & Parameters!StartDate.Value & "' AS DateTime) AND CAST('" & Parameters!EndDate.Value & "' AS DateTime)" &

it is from sql web reporting.

what can we do?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-30 : 01:31:51
you need to make query like this

"SELECT TOP 20 columns..... FROM dbo.Events WITH (INDEX(IX_EVents_TimeGenerated_EventID),nolock)"&
" WHERE (EventID = '9105') AND (Source = 'Syslog-Generic') AND TimeGenerated BETWEEN CAST('" & Parameters!StartDate.Value & "' AS DateTime) AND CAST('" & Parameters!EndDate.Value & "' AS DateTime) " & "ipaddress = " & Parameters!IPAddress.Value

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -