Highlighted
Respected Contributor.
Respected Contributor.
914 views

issues with submessage in id based database flexconnector

Jump to solution

Hello All,

I am creating an id-based database connector to a mssql database. Most of it is working fine. I am getting data into the fields I assign etc.

However, there is one thing that keeps me bugging. I have one field which contains multiple information which differs between event type, so I started working on  submessages. However for some reason this does not seem to work.

I created the submessages through the regex wizard and they all worked in there.

I have even tried with just a default submessage like this:

submessage.messageid.token=event
submessage.token=message

submessage.count=1

submessage[0].pattern.count=1
submessage[0].pattern[0].regex=(.*)
submessage[0].pattern[0].fields=event.message
submessage[0].pattern[0].extramappings=event.name\=__stringConstant("Unparsed event")

But without any luck.

I have tried with agent version 5.0.4.5717 and 5.1.1.5782, but both are not working.

Any ideas?

Regards,

Richard

Labels (2)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Respected Contributor.
Respected Contributor.

Hello Nils,

After this message I opened a case with support and they confirmed me that submessages are only working on regex based parsers. I have expressed my disbeliefe on that without any luck.

The way to solve this is to introduce an extraprocessor based on a regex parser in which you can do your sub messages.

Something like this in your main parser:

 

event.flexString1=__concatenate(__stringTrim(TYPE),"@",__stringTrim(DESCRIPTION))

 

extraprocessor.count=1
extraprocessor[0].type=regex
extraprocessor[0].filename=additional_parser

extraprocessor[0].field=event.flexString1
extraprocessor[0].flexagent=true
extraprocessor[0].clearfieldafterparsing=false

and in your extra processor you separate the 2 fileds and setup the submessages.

Keep in mind that you need to do at least one direct field assignment otherwise the parser will fail to be parsed.

Regards,

Richard

View solution in original post

0 Likes
6 Replies
Highlighted
Honored Contributor.
Honored Contributor.

I pulled up this old post, because the same problem struck me today with a time based database connector version 5.2.7.6474.0. It seems like submessage.xxx- properties in a sdktbdatabase.properties file aren't honoured at all. To verify this I purposefully supplied erronous values (e.g. invalid token-ops, invalid token names) expecting to see Exceptions in agent.log. Nothing hapened.

Is it possible to use submessages in database connectors? As far as I unterstand from the FlexCon DevGuide it should...

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Hello Nils,

After this message I opened a case with support and they confirmed me that submessages are only working on regex based parsers. I have expressed my disbeliefe on that without any luck.

The way to solve this is to introduce an extraprocessor based on a regex parser in which you can do your sub messages.

Something like this in your main parser:

 

event.flexString1=__concatenate(__stringTrim(TYPE),"@",__stringTrim(DESCRIPTION))

 

extraprocessor.count=1
extraprocessor[0].type=regex
extraprocessor[0].filename=additional_parser

extraprocessor[0].field=event.flexString1
extraprocessor[0].flexagent=true
extraprocessor[0].clearfieldafterparsing=false

and in your extra processor you separate the 2 fileds and setup the submessages.

Keep in mind that you need to do at least one direct field assignment otherwise the parser will fail to be parsed.

Regards,

Richard

View solution in original post

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Hi Richard,

thanks for your excellent investigation. Yeah, extraprocessor came to my mind too. I Only was a bit insecure on how to implement one. So thanks for your hints too.

I've achieved desired behavior using conditionalmap. It is in some ways similar to submessage.

conditionalmap.count=1

conditionalmap[0].token=MSG_ID (Same as submessage.messageid.token)

conditionalmap[0].mappings.count=<Same as submessage.count>

conditionalmap[0].mappings[0].values=<Same as submessage[0].messageid>

## PARAM1 is a token name and is the "submessage"

conditionalmap[0].mappings[0].event.destinationUserName=__regexToken(PARAM1,"\\d+:([0-9a-zA-Z]*).*")

# Default mapping for unrecognized "messageid"

conditionalmap[0].mappings[1].event.name=__stringConstant(Unparsed event from db connector)

conditionalmap[0].mappings[1].event.message=__concatenate("No mapping for messageid=",MSG_ID)

After all I think it's quite concise so I'll stick with conditonalmap, if you don't mind .

Cheers Nils

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Hi guys,

Does conditionalmap work for time based database connector?

It's really interesting for me now.

Thanks, Irina

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Hello Irina,

Yes, conditional mapping also works in time based database parsers.

Regards,

RIchard

0 Likes
Highlighted
Established Member..
Established Member..

Awesome job, vandaag!
Do you have an .properties example file to share, showing this resource implementation?
Thanks!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.