Re: [rsyslog] [ommongodb] how to pass content of %msg as raw insert not as a value

2022-10-03 Thread Marcin Mirosław via rsyslog
W dniu 03.10.2022 o 18:55, Mariusz Kruk via rsyslog pisze: Don't know about this particular output module but in general what you want is for rsyslog to parse the message and insert it as json object. Meseems that now rsyslog put %msg% as json object. ( ex: msg: '{"foo":"bar"}' } ) So you

Re: [rsyslog] [ommongodb] how to pass content of %msg as raw insert not as a value

2022-10-03 Thread Mariusz Kruk via rsyslog
Don't know about this particular output module but in general what you want is for rsyslog to parse the message and insert it as json object. So you need to use parse_json() function on the input string and then use proper template which will render the json to appropirate string. I use

Re: [rsyslog] [ommongodb] how to pass content of %msg as raw insert not as a value

2022-10-03 Thread Marcin Mirosław via rsyslog
Maybe when I show examples from mongo it will be more clear. > db.log2.find() [ { _id: ObjectId("633b0ea6b8f2a532cfa6c64c"), msg: '{"foo":"bar"}' }, { _id: ObjectId("633b0eb6b8f2a532cfa6c64d"), foo: 'bar' } ] First record shows how msg is inserted to mongo by rsyslog. Second record is what

Re: [rsyslog] [ommongodb] how to pass content of %msg as raw insert not as a value

2022-10-03 Thread Rainer Gerhards via rsyslog
I do not fully understand the question (maybe language issue on my side), but there is a syntax error: In a string template, properties must be enclosed in percent sign. so: ... string="%msg% HTH Rainer El lun, 3 oct 2022 a las 13:18, Marcin Mirosław via rsyslog () escribió: > > Hello! > Field

[rsyslog] [ommongodb] how to pass content of %msg as raw insert not as a value

2022-10-03 Thread Marcin Mirosław via rsyslog
Hello! Field msg contains complete json with data. I would like to instert it to mongodb as is. But now rsyslog inserts it as a value of key "msg". So now is: msg: '{"foo":"bar"} a i'd like to insert: only: '{"foo","bar"}' I tried with template: template(name="ui-json" type="string"