SumoLogic / sumologic-collector-chef-cookbook

Chef Cookbook for installing and configuring the SumoLogic collector for the Sumo Logic service
Other
30 stars 90 forks source link

sumo_source_local_file - attribute params #70

Closed matt-smith closed 8 years ago

matt-smith commented 8 years ago

Afternoon All,

Just trying to work out the best way to configure several local file sources, at the moment we are using a wrapper cookbook and are looping over the sumo_source_local_file resource.

node['sumologic']['files'].each do |key,value|
  sumo_source_local_file key do
    source_json_directory node['sumologic']['sumo_json_path']
    path_expression value.path_expression
  end
end

My question is, how do we configure the category, filters etc? where should those options go?

I cant see that you can pass anything else to sumo_source_local_file resource?

https://github.com/SumoLogic/sumologic-collector-chef-cookbook/blob/master/libraries/resource_local_file_source.rb

I may be completely misunderstanding the way that the collector is configured, is it possible to configure categories on a per file basis? For example, applicationLogs and osLogs?

zl4bv commented 8 years ago

Hey @matt-smith,

There's a bunch of resources attributes that are common to all the source resource types that you can use. See here.

For example:

node['sumologic']['files'].each do |key,value|
  sumo_source_local_file key do
    source_json_directory node['sumologic']['sumo_json_path']
    path_expression value.path_expression
    source_category 'MySourceCategory'
    filters [
      {
        'filterType' => 'Mask',
        'name' => 'MyFilter',
        'regexp' => '*exclude (this)*',
        'mask' => '####'
      }
    ]
  end
end
matt-smith commented 8 years ago

Thanks for getting back to me @zl4bv, I tried this out and it looks to be working perfectly.