Absent Member.
Absent Member.
679 views

Flex Token Count (ignoring tokens)

Hello,

I am new to Flex connectors and have a simple question.

I need to do a log file flex connector to read my cisco call manager logs.

The call manager writes the logs to some files with the same number of tokens on each line, all the time.

The question is: Each line has 94 comma separated tokens but I just need 4 of them (ex. Token 2, 8, 48 and 60).

Do I need to declare all tokens (1 to 94) and just map the ones I am interested or i could do something like this:

comments.start.with=#
delimiter=,
token.count=4
token[2].name=Time_of_the_event
token[2].type=TimeStamp
token[2].format=yyyy-MM-dd HH:mm:ss
token[4].name=ClientIp
token[4].type=IPAddress
token[48].name=Method
token[48].type=String
token[60].name=URL
token[60].type=String

If this is not write, Does anyone know other way instead of writing a regex file flex connector or declaring all the tokens?

Thanks in advance

Labels (2)
0 Likes
8 Replies
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

You've got it almost right.  You need to tell the connector how many tokens there are in the line and then you can pick and choose which ones you want to actually use.

Change the following line:  token.count=4

To:  token.count=94

Also, keep in mind numbering starts at 0, so token[2] is actually the third field in a line.

0 Likes
Absent Member.
Absent Member.

Would it not make more sense to use a regex expression to trim out the parts your interested in and then format the tokens something along the lines of:

regex=whatever you would need here

comments.start.with=#
token.count=4
token[0].name=Time_of_the_event
token[0].type=TimeStamp
token[0].format=yyyy-MM-dd HH:mm:ss
token[1].name=ClientIp
token[1].type=IPAddress
token[2].name=Method
token[2].type=String
token[3].name=URL
token[3].type=String

This could be a lot more effecient memory wise since you won't be getting all 94 data elements, only the ones you want.

0 Likes
Absent Member.
Absent Member.

Thanks for the help.

I tried with this, but I need to at least declare the Token.names[1..94] or else, the smart connectors complains and i got error.

But thanks again for the help.

Regards,

0 Likes
Absent Member.
Absent Member.

It was a little difficult for me to use regex, because I am new to them but as I needed a folder follower connector, I passed somedays learning and did it using regex.

Thanks for the help.

Regards,

0 Likes
Commodore
Commodore

Take a look at RegexBuddy http://www.regexbuddy.com/. It will help out with your Regex problems.

0 Likes
Absent Member.
Absent Member.

Thanks. This tolls looks like great, although it is not free.

At least we can always use the arcsight regex tool.  =D

Thanks.

Michel

0 Likes

I use Regex Coach. It's free and works very well... very interactive. The regex tool within the connector is great for testing out the flex as a whole, but for just testing regex (especially when you're working on a complex string) this comes in handy.

http://www.snapfiles.com/get/regexcoach.html

0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

I use the same thing, and it works wonderfully.  My SOP is to design it with regex coach, then copy it over to the AS regex tool and verify it works there and add any AS specific tweaks.  I also keep the Regex pocket reference handy

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.