Show TOC

Example: Reading from a Log FileLocate this document in the navigation structure

Populate an input window with entries from a log file.

Procedure

  1. Open Studio and create a new project with a name of your choice.
  2. In the CCL editor, remove the input stream, NEWSTREAM, and add the following:
     CREATE  MEMORY  STORE store1 PROPERTIES  INDEXTYPE ='hash',  INDEXSIZEHINT =8;
    
    CREATE  INPUT  WINDOW TestStream
    SCHEMA ("Date" MSDATE, Host STRING, Request STRING, Rfc931 STRING, 
             UserName STRING, Referrer STRING, Cookies STRING, Status INTEGER, 
             Agent STRING)
    PRIMARY KEY ("Date")
    STORE store1;
  3. Compile and run the project.
  4. Edit the STREAMING_HOME/adapters/logfile_input/example.properties file:
    1. Set Output.Uri to the URI where the project is running. For example, esp[s]://localhost:9786/default/logfile_example.
    2. Set Output.AuthType to UserPassword.
    3. Set Output.Username to the username you set for your local cluster.
    4. Set Output.Password to the password you set for your local cluster.
  5. Start the adapter:
    1. Open a command line and navigate to STREAMING_HOME/adapters/logfile_input.
    2. Execute the following command:
      • In Windows,
        java -cp %CP% -Dproperties=example.properties com.adapter.logFileInput.Main
      • In Unix,
        java -cp $CP -Dproperties=example.properties com.adapter.logFileInput.Main
  6. Open the TestStream window in the Stream View of Studio to confirm that the window is populated with data from the STREAMING_HOME/adapters/logfile_input/example.log file.