Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Assigning multiple categories to a message

Elbert
2009-08-11
2013-04-11
  • Elbert
    Elbert
    2009-08-11

    Does scribe currently support this feature? If not, does anyone have any ideas how it could be accomplished?

    Is it possible to assign multiple categories to a message? Essentially, I want to be able to send a given message to multiple locations. The message should only be generated once. Currently, I'm testing by going through the examples and using scribe_cat. I want to be able to do something like....

    echo "test" | ./scribe_cat -h localhost:1464 cat1,cat2

    The message should end up in both final locations as described in the conf file for cat1 and cat2. One possibility is to have it go to cat1, then as I intend for cat1 to be a file, to feed the contents of cat1 to cat2 somehow, but it seems like there should be a better way.

    Thanks!

     
    • Scribe only supports a single category per message.  But all you would need to do is log the message multiple times with each category you want.

      scribe_cat is an example script to show you one way of sending a message to scribe.  You can either call scribe_cat multiple times, or you can simply edit this script to support sending multiple messages when passed multiple categories.

      -Anthony

       
    • Elbert
      Elbert
      2009-08-11

      Anthony, thanks for responding so quickly. I decided to go ahead and incorporate multiple-category sending into  the client side. I'm doing exactly as you recommend: log the message and send to each category.

      Thanks!

       
    • Elbert
      Elbert
      2009-08-17

      Anthony,

      As it turns out, there is a scribe-native way to achieve what I wanted to achieve. I wanted to send a message to multiple destinations, thinking that each destination should be tied to one category and that scribe might then parse the categories and send the message off each. I'm making use of the store type of "multi" to achieve this result.

      Essentially, the store of type category contains multiple stores, and the message gets routed to each store. This seems to work pretty smoothly, and it provides better performance than sending the message multiple times to scribe through an external script. In this example, each message is being sent across the network to cc101 and also written to a local file in /var/elbert.

      The config file is pasted below.

      # DEFAULT
      <store>
      type=multi
      report_success=all
      category=ads

      <store0>
      type=buffer
      target_write_size=20480
      max_write_interval=1
      buffer_send_rate=1
      retry_interval=5
      retry_interval_range=2

      <primary>
      type=network
      remote_host=cc101.sc9.int
      remote_port=1463
      </primary>

      <secondary>
      type=file
      fs_type=std
      file_path=/var/1463
      base_filename=thisisoverwritten
      max_size=3000000
      </secondary>
      </store0>

      <store1>
      type=buffer

      target_write_size=20480
      max_write_interval=1
      buffer_send_rate=1
      retry_interval=5
      retry_interval_range=2

      <primary>
      type=file
      fs_type=std
      file_path=/var/elbert
      base_filename=thisisoverwritten
      max_size=1000000000
      add_newlines=0
      </primary>

      <secondary>
      type=file
      fs_type=std
      file_path=/var/elbert2
      base_filename=thisisoverwritten
      max_size=3000000
      </secondary>
      </store1>

      </store>

       
    • Ah, ok.  Now that I understand what you are trying to do, there is actually a simple solution,

      You can just create 2 separate stores for the same category (without even needing to use a multistore).  The only drawback is that you can only do this if you give the full category name (ie you can't currently have multiple 'default' or "prefix*" stores).

      -Anthony