Generating a custom named csv in Delimited Text Driver


Hi ,

I am trying to develop a delimited text driver that will listen to add /
modify events and generate a csv file output. I have used the default
configurations in driver and has defined the schema and the filter for
the required attributes.

Whenever there is a add event we are able to get a .csv file (for the
defined attributes) as output, but the file name is a timestamp.
Something like 185914481233.csv. I am not sure from where this name is
getting generated.

My requirement is if the event is

1. for create user , the csv file generated should have a name as
c-username-timestamp.csv
2. for update user , the csv file generated should have a name as
U-username-timestamp.csv

Can you please let me know how i can do this customization for file name
?


--
kalariviswa
------------------------------------------------------------------------
kalariviswa's Profile: https://forums.netiq.com/member.php?userid=9296
View this thread: https://forums.netiq.com/showthread.php?t=56218

  • kalariviswa <kalariviswa@no-mx.forums.microfocus.com> wrote:
    >

    Hi ,
    >
    > I am trying to develop a delimited text driver that will listen to add /

    modify events and generate a csv file output. I have used the default
    configurations in driver and has defined the schema and the filter for
    the required attributes.
    >
    > Whenever there is a add event we are able to get a .csv file (for the

    defined attributes) as output, but the file name is a timestamp.
    Something like 185914481233.csv. I am not sure from where this name is
    getting generated.
    >


    This is just the way the standard delimited text driver works, it doesn't
    create one file per event. Instead it dumps results out until a
    configurable time period has elapsed and then renames the file and starts
    on a new one.

    > My requirement is if the event is
    >
    > 1. for create user , the csv file generated should have a name as

    c-username-timestamp.csv
    > 2. for update user , the csv file generated should have a name as

    U-username-timestamp.csv
    >
    > Can you please let me know how i can do this customization for file name


    You would need a post processor for this or you should try the generic text
    driver. Pretty sure the latter can do what you want without too much
    trouble.

    --
    If you find this post helpful and are logged into the web interface, show
    your appreciation and click on the star below...

  • kalariviswa;2433523 wrote:
    Hi ,

    I am trying to develop a delimited text driver that will listen to add /
    modify events and generate a csv file output. I have used the default
    configurations in driver and has defined the schema and the filter for
    the required attributes.

    Whenever there is a add event we are able to get a .csv file (for the
    defined attributes) as output, but the file name is a timestamp.
    Something like 185914481233.csv. I am not sure from where this name is
    getting generated.

    My requirement is if the event is

    1. for create user , the csv file generated should have a name as
    c-username-timestamp.csv
    2. for update user , the csv file generated should have a name as
    U-username-timestamp.csv

    Can you please let me know how i can do this customization for file name
    ?


    --
    kalariviswa
    ------------------------------------------------------------------------
    kalariviswa's Profile: https://forums.netiq.com/member.php?userid=9296
    View this thread: https://forums.netiq.com/showthread.php?t=56218


    Hi kalariviswa,
    Like usual you have more than one way to get required result!
    1. You can use Stefaan's Generic File Driver

    It has much more flexibility in file operation configuration (and other functionality), than "standard" Delimited Text Driver.
    You can review these options on this link http://vancauwenberge.info/#txtdriver_configuration_subscriber.

    2. Use ecmascript file-access functions and have complete control for file operations.
    I used this method for generate "custom" logs for on-boarding driver (generated file name included cn and date information).


    We have number of ECMA functions with similar functionality.
    function writeFile(fileName, contentString)
    function fileRead(filepath)
    function ReadFromFile(fileName)
    function appendToFile(fileName, text)


    Geoffrey shared number of these functions in his CSs
    https://www.netiq.com/communities/cool-solutions/open-call-useful-ecma-functions-use-identity-manager/
    https://www.netiq.com/communities/cool-solutions/wp-content/uploads/sites/2/2009/06/ECMALibrary.txt
  • al b wrote:

    > 2. Use ecmascript file-access functions and have complete control for
    > file operations.
    > I used this method for generate "custom" logs for on-boarding driver
    > (generated file name included cn and date information).
    >
    >
    > We have number of ECMA functions with similar functionality.
    > > function writeFile(fileName, contentString)
    > > function fileRead(filepath)
    > > function ReadFromFile(fileName)
    > > function appendToFile(fileName, text)

    >


    Just a note: not all of these are thread-safe and thus extreme care
    should be used when calling these functions from multiple drivers or
    even from publisher and subscriber channel in the same driver.

  • As Al wrote there are several ways to do this.

    Since I try to avoid post-processors since they tend to get un-documented and people forget about that they exist I would go with the Generic File Driver.

    The only tricky part that you have in your requirement:
    My requirement is if the event is

    1. for create user , the csv file generated should have a name as
    c-username-timestamp.csv
    2. for update user , the csv file generated should have a name as
    U-username-timestamp.csv


    is the prefix U and C for this I think you need to do some clever rules together with the abilities in the generic file driver.

    As Al writes, this is easy to do with ecma scripts as well but there is a risk with it being single threaded if you use it in a lot of places.