hi Robert,
you are having this problem because %a variable is an action list
variable -- it can only be employed within action lists, not context
expressions. Instead of %a, I would recommend to use a Perl variable.
For example, instead of returning an incremented value from the
'lcall' action, you could set a Perl variable $a inside the function,
and use it later in the context expression.
Also, how many different seqnumbers you have across log file messages?
If not too many, you could also create a context SEQNUM_%a, and check
its presence in the second rule.
hope this helps,
risto

2012/3/1 Robert Charroux <[email protected]>:
> Hi,
>
> I'm trying to report on a new file creation on windows events (converted to
> syslog format by a python script) with the following rules:
>
> I want to get the seqnumber of the log line, increment it and use it to
> copmpare with the seqnumber of matching rule2 log line.
>
> #logtime $1, host $2, servername $3, seqnum $4, evttime $5, sid $6, filepath
> $7, username $9, clientip $10, acessmask $11
> type = Single
> ptype = RegExp
> pattern
> =^(\d+-\d\d-\d\dT\d\d:\d\d:\d\d\+\d\d:\d\d)\s+<\S+\.\S+>\s+(\S+)\s+python:
> \\\\(.*?)\\.*,(\d+),(\d{4}-\d{2}-\d{2}\s+\d\d:\d\d:\d\d).*560.*Success\s+Audit.*(S-1.*?),.*Object\s+Name:\s+(.*)\\(nouveau\sfichier|new\sfile)\s+Handle\s+ID.*User\s+Name:\s+(\S+).*Client\s+User\s+Name:\s+(\S+).*DELETE.*Access\s+Mask:\s+(\S+).*$
> desc = 560 $3 object delete new file in $7 by $9 from $10 at $5
> --> action = lcall %a $4 -> ( sub { return int($_[0])+1 } );
>
> # filename $8#context = $4 -> (sub { return (%ret == int($_[0])-1) } )
> type = Single
> ptype = RegExp
> pattern
> =^(\d+-\d\d-\d\dT\d\d:\d\d:\d\d\+\d\d:\d\d)\s+<\S+\.\S+>\s+(\S+)\s+python:
> \\\\(.*?)\\.*,(\d+),(\d{4}-\d{2}-\d{2}\s+\d\d:\d\d:\d\d).*560.*Success\s+Audit.*(S-1.*?),.*Object\s+Name:\s+(.*)\\(.*)\s+Handle\s+ID.*User\s+Name:\s+(\S+).*Client\s+User\s+Name:\s+(\S+).*WriteData.*Access\s+Mask:\s+(\S+).*$
> desc = $9 created file $8 on $3 in $7 from $10 at $5
> --> context = =("$4" eq "%a")
> action = write - %s !;
>
> problem is with action = lcall %a $4 -> ( sub { return int($_[0])+1 } ); in
> rule1 and context = =("$4" eq "%a") in rule2
> It never match.... because it seems that i can't access the value that %a
> contains :-(
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Simple-evcorr-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
>

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to