How to add fields to event from ruby plugin

My config file accumulates data in the Class variables and does so until it's time to write out the 'aggregated' values into the Event. I don't know how to do that. Here is the code I have, which doesn't work. How do I add those fields into the Event?

            # When the Invoice Amount arrives, write out all the accumulated data to the Event
            if ([@metadata][amount] =~ /.+/) {
                ruby{
                    code => "@@InvoiceCurrency = event['@metadata']['currencyCode']
                             @@InvoiceAmount = event['@metadata']['amount']
                             
                             event = event + 
                             ' tslice=' + @@TimeStamp + 
                             ' senderID=' + @@SenderId + 
                             ' waterMark=' + @@WaterMark + 
                             ' accountId=' + @@AccountId + 
                             ' externalSource=' + @@ExternalSource + 
                             ' invoiceNumber=' + @@InvoiceNumber + 
                             ' invoiceDate=' + @@InvoiceDate + 
                             ' invoiceType=' + @@InvoiceType +
                             ' invoiceCurrency=' + @@InvoiceCurrency + 
                             ' invoiceAmount=' + @@InvoiceAmount "
                 }
            }
event['tslice'] = @@TimeStamp
event['senderID'] = @@SenderId
...
1 Like

That simple, eh? I was thinking that only pertains to fields that already exist in the event.... thanks very much.