Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 13.02.2006, 10:56   #1
kembl
Архивный участник
 
Join Date: May 2005
Posts: 63
Default [Share] New La2_logd Server ( Perl edition)

Hi all, there perl version of Lin2Logd server.
Whats differenses from off version:

1) No more resident La2 server in the memory (+ RAM)
2) You can setup your own log insertion period ( only 30 mins, in standart L2Logd.exe)
3) You can insert logs offline to prefered DB
4) You can configure this server to insert only what you needs
5) You can insert several log dirs at once, by running prefered count of this servers.
6) No-db mode, where all logs print to STDOUT, you can collect it ( > la2.sql ) to *.sql file, and

insert it by MS Query Analyzer
7) You can run server in silent mode (without any STDOUT).
8) Have got error log file
9) More correct work with authd logs, than in standart l2logd server (so users IP wil appear in L2Admin

Action Logs)

... and more options in next future ( minor cheat detection for example );

+) More correct lin_CheckLogTimeTable2 procedure (audit logs adds)

All You needs, is:
1) Instal ActiveState Perl
2) Install DBD::ODBC (perl module, try ppm3.bat from perl\bin dir)
3) Configure la2_logd.pl ( see in to file, section SERVER CONFIG)
4) Restart L2server, whithout L2Logd, and add start this script like perl.exe la2_logd.pl

usage: la2_logd.pl [-a|-sa|-ca|etc...](without args it work with all logs, l2logd except)
la2_logd.pl -c (work with only cached logs)
la2_logd.pl -a (work with only authd logs)
la2_logd.pl -s (work with only l2server logs)
la2_logd.pl -n (work with only l2npc logs)
la2_logd.pl -l (work with only l2logd logs, not used by default)
la2_logd.pl -na (work with only l2npc logs, type audit)
la2_logd.pl -ci (work with only cached logs, in type (system))
la2_logd.pl -sa (work with only l2server logs, type audit)


There you can see two screens, it shows how server work flows.
This version was tested on more than 18Gb logs (half month), without any serious errors.

You can feel free to use this script at your own needs, it is not complex, and have more comments.

If you have got hex fix from login two users with one char (for self selling and dupe resources), so

please share it. Torune's patch is great, but ability for char cloning still exists.

<rus>Новый сервер логов, позволяет гораздо гибче настроить процесс их вставки, позволяет регулировать переодичность, тип вставляемых логов, выдает данные в sql формате, для последующей вставки через альтернативные MsSQL интерфейсы (Query Analyzer), учтены косяки оригинального логсервера. Народ, не жмитесь, поделитесь у кого есть хексом на дюп вещей. Ловить таких в логах хорошо, но лучше убрать
причину.</rus>

Code:
/********************************************
lin_CheckLogTimeTable2
	do check whether real time log table is exist or not
INPUT
	@strDate varchar(16),
	@nWorld  int
OUTPUT
	
return
made by
	young
date
	2002-11-11
corrected by
	KEMBL
corrects
	insert audit table to log_data view
date
	2005-12-04
********************************************/
CREATE PROCEDURE [DBO].[lin_CheckLogTimeTable2]
(
	@strDate varchar(16),
	@nWorld  int
)
AS
SET NOCOUNT ON

declare @table_name varchar(60)
declare @table_audit_name varchar(60)
declare @table2_name varchar(60)
declare @view_name varchar(60)
declare @sql varchar(2048)

-- check log_realtime
set @table_name = @strDate + 'log_realtime_' + cast (@nWorld as varchar)
set @sql = 'select * from sysobjects (nolock) where name = '''+ @table_name + ''''

exec ( @sql)
if ( @@ROWCOUNT = 0) 
begin
	set @sql = 'exec lin_MakeLogTable ''' + @table_name + ''''
	exec (@sql)
end

-- check log_audit
set @table_audit_name = @strDate + 'log_audit_' + cast (@nWorld as varchar)
set @sql = 'select * from sysobjects (nolock) where name = '''+ @table_audit_name + ''''
exec ( @sql)
if ( @@ROWCOUNT = 0) 
begin
	set @sql = 'exec lin_MakeLogTable ''' + @table_audit_name + ''''
	exec (@sql)
end

-- check log_data ( store 0~12 hour log)
set @table_name = @strDate + 'log_data_' + cast (@nWorld as varchar)
set @sql = 'select * from sysobjects (nolock) where name = '''+ @table_name + ''''
exec ( @sql)
if ( @@ROWCOUNT = 0) 
begin
	set @sql = 'exec lin_MakeLogTable ''' + @table_name + ''''
	exec (@sql)
end

-- check log_data2 ( store 12~24 hour log)
set @table2_name = @strDate + 'log_data2_' + cast (@nWorld as varchar)
set @sql = 'select * from sysobjects (nolock) where name = '''+ @table2_name + ''''
exec ( @sql)
if ( @@ROWCOUNT = 0) 
begin
	set @sql = 'exec lin_MakeLogTable ''' + @table2_name + ''''
	exec (@sql)
end

-- check log_data0 ( view )
set @view_name = @strDate + 'log_data0_' + cast (@nWorld as varchar)
set @sql = 'select * from sysobjects (nolock) where name = '''+ @view_name + ''''
exec ( @sql)
if ( @@ROWCOUNT = 0) 
begin
--	set @sql = 'exec lin_MakeLogTable ''' + @table_name + ''''
	set @sql = 'CREATE VIEW dbo.' + @view_name + '  ( ' 
		+ ' act_time,  log_id, actor, actor_account, target, target_account, location_x, location_y, location_z, ' 
		+ 'etc_str1, etc_str2, etc_str3,  ' 
		+ 'etc_num1, etc_num2, etc_num3, etc_num4, etc_num5, etc_num6, etc_num7, etc_num8, etc_num9, etc_num10, ' 
		+ 'STR_actor, STR_actor_account, STR_target, STR_target_account, item_id ' 
		+ ' ) AS ' 
		+ ' SELECT  act_time,  log_id, actor, actor_account, target, target_account, location_x, location_y, location_z, '
		+ ' etc_str1, etc_str2, etc_str3,  ' 
		+ ' etc_num1, etc_num2, etc_num3, etc_num4, etc_num5, etc_num6, etc_num7, etc_num8, etc_num9, etc_num10, '
		+ ' STR_actor, STR_actor_account, STR_target, STR_target_account, item_id ' 
		+ ' from   ' + @table_name  + '  (nolock) UNION ALL '
		+ ' SELECT  act_time,  log_id, actor, actor_account, target, target_account, location_x, location_y, location_z, '
		+ ' etc_str1, etc_str2, etc_str3,  ' 
		+ ' etc_num1, etc_num2, etc_num3, etc_num4, etc_num5, etc_num6, etc_num7, etc_num8, etc_num9, etc_num10, '
		+ ' STR_actor, STR_actor_account, STR_target, STR_target_account, item_id ' 
		+ ' from   ' + @table_audit_name  + '  (nolock) UNION ALL '
		+ ' SELECT  act_time,  log_id, actor, actor_account, target, target_account, location_x, location_y, location_z, '
		+ ' etc_str1, etc_str2, etc_str3,  '
		+ ' etc_num1, etc_num2, etc_num3, etc_num4, etc_num5, etc_num6, etc_num7, etc_num8, etc_num9, etc_num10, '
		+ ' STR_actor, STR_actor_account, STR_target, STR_target_account, item_id '
		+ ' from   ' + @table2_name + '  (nolock)  '


	exec (@sql)
end

-- check chat 
set @table_name = @strDate + 'log_chat_' + cast (@nWorld as varchar)
set @sql = 'select * from sysobjects (nolock) where name = '''+ @table_name + ''''
exec ( @sql)
if ( @@ROWCOUNT = 0) 
begin
	set @sql = 'exec lin_MakeChatLogTable ''' + @table_name + ''''
	exec (@sql)
end
GO
!!!!!!! UPDATED xx.xx.2006 !!!!!!!!!!!!
NEW VERSION 5.9.6 - more optimisations, more falures check, more command options! Full L2Admin interface compatible

http://game.aaanet.ru/tools/la2/la2_logd.5.9.6.zip
kembl is offline  
Old 13.02.2006, 17:01   #2
hr
Архивный участник
 
Join Date: Jun 2005
Posts: 285
Default

GOOD JOB! I'm making similar tool for automatic log inserting from multiple servers.
ps: use perl2exe and you will have no problems with perl installation on server.
pps: imho better (faster) use sysread() instead of basic "per line" reading
hr is offline  
Old 13.02.2006, 17:19   #3
sct
Архивный участник
 
Join Date: Nov 2005
Posts: 70
Default

Awesome! Great job thanks.
sct is offline  
Old 13.02.2006, 22:40   #4
kgptzac
Архивный участник
 
Join Date: Jan 2006
Posts: 363
Default

uh.... i think "Lineage" is one word, not "Line-Age"... therefore "La2" is... incorrect.
kgptzac is offline  
Old 14.02.2006, 01:02   #5
rodier
Архивный участник
 
Join Date: May 2005
Posts: 979
Default

hmm can anyone explain in few words advantage of this LogD server?

Anyone got log parser that told me who (char_id) got which item (uniq id, item type) from who (char_id) and when ? ;-DD reading trought gb of logs is very... interest ;]
rodier is offline  
Old 14.02.2006, 07:45   #6
m4rk
Архивный участник
 
Join Date: Jan 2006
Posts: 607
Default

[off]
Quote:
Anyone got log parser that told me who (char_id) got which item (uniq id, item type) from who (char_id) and when ? ;-DD reading trought gb of logs is very... interest ;]
I think all that can be done with l2admin.
[/off]

Thanks for this server version, I'll check it
m4rk is offline  
Old 14.02.2006, 07:59   #7
kembl
Архивный участник
 
Join Date: May 2005
Posts: 63
Default

>Anyone got log parser that told me who (char_id) got which item (uniq id,
>item type) from who (char_id) and when

This is standart dupe transaction (for example):

02/03/2006 12:29:xx.xx6, 932,52095,13267,52095,13267,118394,-171034,-24,,,,4,1,53,1,53,1,0,1458,7054,1,12434512,bal,124 34512,bal,4576443

02/03/2006 12:29:xx.xx9, 931,52095,13267,52095,13267,118394,-171034,-24,,,,4,1,53,1,53,1,0,1458,-14108,1,12434512,bal,12434512,bal,4576443

code 931 = PrivateStoreSell
code 932 = PrivateStoreBuy

look how it seems on the la2admin:

2006-02-03 12:29:01 12434512 bal PrivateStoreBuy 118394 -171034 -24 Race=Dwarf Gender=Female Class=Dwarven Fighter Level=1 Target Character's Class=Dwarven Fighter Target Character's Level=1 Enchant=0 Item Type=Crystal: D Grade Change in Quantity=7054 Price=1 Unique ID=4576443 12434512 bal

2006-02-03 12:29:01 12434512 bal PrivateStoreSell 118394 -171034 -24 Race=Dwarf Gender=Female Class=Dwarven Fighter Level=1 Target Character's Class=Dwarven Fighter Target Character's Level=1 Enchant=0 Item Type=Crystal: D Grade Change in Quantity=-14108 Price=1 Unique ID=4576443 12434512 bal

as you can see, bal sell Crystal D to him self

so we can construct SQL request, whitch shows, who did the same
Code:
SELECT R1.STR_actor, R1.STR_actor_account
FROM (
	SELECT * FROM lin2log..L2006_02_13_log_data0_1 (nolock) WHERE log_id IN	(931) AND STR_actor = STR_target
  UNION ALL
	SELECT * FROM lin2log..L2005_02_13_log_data0_1 (nolock) WHERE log_id IN	(931) AND STR_actor = STR_target
)	AS R1 
GROUP By R1.STR_actor, R1.STR_actor_account, R1.actor, R1.actor_account
But this all only postfix, the right way to solve this problem, is block self selling.

>uh.... i think "Lineage" is one word, not "Line-Age"... therefore "La2" is...
>incorrect.

If that, we mast to use only full name - Lineage2, or small L2. Full name is too long for programmers forum where all understand each other right, small name tell nothing special. I think "la2" is the name which may have they place there Peoples english talk protocol (PETP) allows this
kembl is offline  
Old 14.02.2006, 08:28   #8
Dmytro
Архивный участник
 
Join Date: Nov 2005
Posts: 215
Default

Thx for your work.

But Perl less demanding to resource than LogD ?
Sure, if this is server, and it have WEB service, this thing is more needed (and have open source).
Dmytro is offline  
Old 14.02.2006, 10:32   #9
kembl
Архивный участник
 
Join Date: May 2005
Posts: 63
Default

>But Perl less demanding to resource than LogD ?

l2logd is M$VC application, so it much more faster. But as you wrote, it is not open source, and cant be modifyed. On other hand, l2logd needs to be allways in your RAM, perl edition may run when it needs ( at deep night, when no ppl in game, for example).

We run it every 60 sec, and have no lags on server (600+) with this configuration:

AMD Athlon 64 3800+ X2 (Socket 939, 1024KB L2);
ASUS A8N-SLI Deluxe;
4x1Gb Kingston DDR SDRAM PC3200;
HDD 70GB 10000rpm; MsSQL EXPRESS 2005 CTP
kembl is offline  
Old 10.08.2006, 17:36   #10
kembl
Архивный участник
 
Join Date: May 2005
Posts: 63
Default

NEW VERSION 5.9.6 - more optimisations, more falures check, more command options! Full L2Admin interface compatible

http://game.aaanet.ru/tools/la2/la2_logd.5.9.6.zip

See first message
kembl is offline  
Old 27.09.2006, 06:12   #11
Charis
Архивный участник
 
Join Date: Feb 2006
Posts: 39
Default

Sometimes I got that message

SQL request: UPDATE lin2log..log_insert SET rowsprocessed=730, process_time=8 WH
ERE log_file='2006-09-21-11-201-authd-in1.log'
SQL request:
DBD::ODBC::db prepare failed: [Microsoft][ODBC Driver Manager] Invalid string or
buffer length (SQL-HY090)(DBD: st_prepare/SQLPrepare err=-1) at la2_logd.pl lin
e 433.
DBD::ODBC::db prepare failed: [Microsoft][ODBC Driver Manager] Invalid string or
buffer length (SQL-HY090)(DBD: st_prepare/SQLPrepare err=-1) at la2_logd.pl lin
e 433.

As I see from DB - Updated is Done - but after that it's stop working...

Any ideas?
Charis is offline  
Old 27.09.2006, 08:30   #12
TheOrder
Архивный участник
 
Join Date: Sep 2005
Posts: 731
Default

GJ M8 awsome share !
TheOrder is offline  
Old 15.10.2006, 17:58   #13
Charis
Архивный участник
 
Join Date: Feb 2006
Posts: 39
Default

I have some problem - but I dont know how te resolve it

My chat logs contains russian letters, and LogD is running on different computer. Both server and log computers have Ukrainian locale. There is all right if I just open log files - I see chat logs correctly...
But when perl starts parsing I see in DB something like this

ii?ao iu aan ia eeaaaeua iiai?a?i?

I guess it's incorrect encoding?
anybody knows how to fix that?
Charis is offline  
Old 15.10.2006, 20:34   #14
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

Code:
<meta http-equiv="Content-Type" content="text/html; windows-1251">
hel is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 18:08.