
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Take a look at RegexBuddy http://www.regexbuddy.com/. It will help out with your Regex problems.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Thanks. This tolls looks like great, although it is not free.
At least we can always use the arcsight regex tool. =D
Thanks.
Michel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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