Skip to content

Commit

Permalink
Merge pull request #1 from cloud-gov/Dependencies
Browse files Browse the repository at this point in the history
adding in script and gemspec updates
  • Loading branch information
JasonTheMain authored Sep 12, 2024
2 parents bf8fdfd + 81da03c commit aaf9f04
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
18 changes: 15 additions & 3 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/log
### 1. Plugin Developement and Testing

#### Code

- To get started, you'll need JRuby with the Bundler gem installed.

- Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).

- Install dependencies

```sh
bundle install
jruby -S bundle install
```

#### Test
Expand All @@ -48,39 +50,49 @@ bundle exec rspec
#### 2.1 Run in a local Logstash clone

- Edit Logstash `Gemfile` and add the local plugin path, for example:

```ruby
gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
```

- Install plugin

```sh
bin/plugin install --no-verify
```

- Run Logstash with your plugin

```sh
bin/logstash -e 'filter {awesome {}}'
```

At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.

#### 2.2 Run in an installed Logstash

You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:

- Build your plugin gem

```sh
gem build logstash-filter-awesome.gemspec
```

- Install the plugin from the Logstash home

```sh
bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
```

- Start Logstash and proceed to test the plugin

## Contributing

All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.

Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.

It is more important to the community that you are able to contribute.

For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
8 changes: 6 additions & 2 deletions lib/logstash/inputs/cloudwatch_logs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ def process_group(group)
:next_token => next_token
}
resp = @cloudwatch.filter_log_events(params)

resp.events.each do |event|
process_log(event, group)
end
Expand All @@ -207,13 +206,18 @@ def process_group(group)
# def process_log
private
def process_log(log, group)

tag_params = {
:log_group_name => group
}
tag = @cloudwatch.list_tags_log_group(tag_params)
@logger.debug("processing_log #{log}")
@codec.decode(log.message.to_str) do |event|
event.set("@timestamp", parse_time(log.timestamp))
event.set("[cloudwatch_logs][ingestion_time]", parse_time(log.ingestion_time))
event.set("[cloudwatch_logs][log_group]", group)
event.set("[cloudwatch_logs][log_stream]", log.log_stream_name)
event.set("[cloudwatch_logs][event_id]", log.event_id)
event.set("[cloudwatch_logs][tags]", tag.tags)
decorate(event)

@queue << event
Expand Down
9 changes: 3 additions & 6 deletions logstash-input-cloudwatch_logs.gemspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
Gem::Specification.new do |s|

s.name = 'logstash-input-cloudwatch_logs'
s.version = '1.0.3'
s.licenses = ['Apache License (2.0)']
s.version = '1.1.0'
s.licenses = ['Apache-2.0']
s.summary = 'Stream events from CloudWatch Logs.'
s.description = 'This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program'
s.authors = ['Luke Waite']
s.email = 'lwaite@gmail.com'
s.homepage = ''
s.require_paths = ['lib']

Expand All @@ -21,8 +19,7 @@ Gem::Specification.new do |s|

# Gem dependencies
s.add_runtime_dependency 'logstash-core-plugin-api', '>= 1.60', '<= 2.99'
s.add_runtime_dependency 'logstash-mixin-aws', '>= 4.3.0'
s.add_runtime_dependency 'logstash-integration-aws', '>= 7.1.0'
s.add_runtime_dependency 'stud', '~> 0.0.22'

s.add_development_dependency 'logstash-devutils'
end

0 comments on commit aaf9f04

Please sign in to comment.