jfrog-saas-log-collector 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9c2f46faac629e4f27dba067ead82eab90586e2a8a888a35c847e81701bf4847
4
+ data.tar.gz: 2f6ad9cedcdf46fbbfc36ee95551b04fff1da2fd362346d143e1239d8ba961ec
5
+ SHA512:
6
+ metadata.gz: 589f0526abe38f28aab6cd7e0f5a7439ebd26a6a9cb28ea4bfe9fb01c9aca413e19d5202e89fbe322d491e34bedbf30acf23d2f83cfbaa32ac483f817c627da2
7
+ data.tar.gz: 404840d4c2649773586f7c35f8599a8bcb1d4b00d734b8e36f56c44d797892005fdae468e891dc21723386095f02e07a2684926be661abf67ae762e884eb205d
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ ## [ jfrog-saas-log-collector change log ]
2
+
3
+ ## [0.1.1] - 2022-04-04
4
+
5
+ - Initial release
6
+
7
+ ## [0.1.1 - 0.1.4] - 2022-04-05 - Yanked
8
+
9
+ - Added Scheduler and Job concurrency handling if the gem is run in multiple terminals for the same config
10
+
11
+ ## [0.1.5] - 2022-04-06
12
+
13
+ - Fixes to config file validation due to missing encoding
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at vasukin@jfrog.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'rake', '~> 13.0'
8
+
9
+ gem 'minitest', '~> 5.0'
10
+
11
+ gem 'rubocop', '~> 1.21'
12
+
13
+ gem 'faraday', '~> 2.2.0'
14
+
15
+ gem 'faraday-follow_redirects', '~> 0.2.0'
16
+
17
+ gem 'faraday-gzip', '~> 0.1.0'
18
+
19
+ gem 'faraday-retry', '~> 1.0.3'
20
+
21
+ gem 'zlib', '~> 2.1.1'
22
+
23
+ gem 'parallel', '~> 1.21.0'
24
+
25
+ gem 'logger', '~> 1.5.0'
26
+
27
+ gem 'rufus-scheduler', '~> 3.8.1'
28
+
29
+ gem 'json-schema', '~> 2.8.1'
30
+
31
+ gem 'addressable', '~> 2.8.0'
32
+
33
+ gem 'tzinfo', '~> 2.0.4'
34
+
35
+ gem 'tzinfo-data', '~> 1.2021.5'
data/Gemfile.lock ADDED
@@ -0,0 +1,94 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jfrog-saas-log-collector (0.1.1)
5
+ addressable (~> 2.8.0)
6
+ faraday (~> 2.2.0)
7
+ faraday-follow_redirects (~> 0.2.0)
8
+ faraday-gzip (~> 0.1.0)
9
+ faraday-retry (~> 1.0.3)
10
+ json-schema (~> 2.8.1)
11
+ logger (~> 1.5.0)
12
+ minitest (~> 5.0)
13
+ parallel (~> 1.21.0)
14
+ rake (~> 13.0)
15
+ rubocop (~> 1.21)
16
+ rufus-scheduler (~> 3.8.1)
17
+ zlib (~> 2.1.1)
18
+
19
+ GEM
20
+ remote: https://rubygems.org/
21
+ specs:
22
+ addressable (2.8.0)
23
+ public_suffix (>= 2.0.2, < 5.0)
24
+ ast (2.4.2)
25
+ concurrent-ruby (1.1.10)
26
+ et-orbi (1.2.7)
27
+ tzinfo
28
+ faraday (2.2.0)
29
+ faraday-net_http (~> 2.0)
30
+ ruby2_keywords (>= 0.0.4)
31
+ faraday-follow_redirects (0.2.0)
32
+ faraday (>= 2, < 3)
33
+ faraday-gzip (0.1.0)
34
+ faraday (>= 1.0)
35
+ zlib (~> 2.1)
36
+ faraday-net_http (2.0.1)
37
+ faraday-retry (1.0.3)
38
+ fugit (1.5.2)
39
+ et-orbi (~> 1.1, >= 1.1.8)
40
+ raabro (~> 1.4)
41
+ json-schema (2.8.1)
42
+ addressable (>= 2.4)
43
+ logger (1.5.0)
44
+ minitest (5.15.0)
45
+ parallel (1.21.0)
46
+ parser (3.1.0.0)
47
+ ast (~> 2.4.1)
48
+ public_suffix (4.0.6)
49
+ raabro (1.4.0)
50
+ rainbow (3.1.1)
51
+ rake (13.0.6)
52
+ regexp_parser (2.2.0)
53
+ rexml (3.2.5)
54
+ rubocop (1.25.0)
55
+ parallel (~> 1.10)
56
+ parser (>= 3.1.0.0)
57
+ rainbow (>= 2.2.2, < 4.0)
58
+ regexp_parser (>= 1.8, < 3.0)
59
+ rexml
60
+ rubocop-ast (>= 1.15.1, < 2.0)
61
+ ruby-progressbar (~> 1.7)
62
+ unicode-display_width (>= 1.4.0, < 3.0)
63
+ rubocop-ast (1.15.1)
64
+ parser (>= 3.0.1.1)
65
+ ruby-progressbar (1.11.0)
66
+ ruby2_keywords (0.0.5)
67
+ rufus-scheduler (3.8.1)
68
+ fugit (~> 1.1, >= 1.1.6)
69
+ tzinfo (2.0.4)
70
+ concurrent-ruby (~> 1.0)
71
+ unicode-display_width (2.1.0)
72
+ zlib (2.1.1)
73
+
74
+ PLATFORMS
75
+ x86_64-darwin-21
76
+
77
+ DEPENDENCIES
78
+ addressable (~> 2.8.0)
79
+ faraday (~> 2.2.0)
80
+ faraday-follow_redirects (~> 0.2.0)
81
+ faraday-gzip (~> 0.1.0)
82
+ faraday-retry (~> 1.0.3)
83
+ jfrog-saas-log-collector!
84
+ json-schema (~> 2.8.1)
85
+ logger (~> 1.5.0)
86
+ minitest (~> 5.0)
87
+ parallel (~> 1.21.0)
88
+ rake (~> 13.0)
89
+ rubocop (~> 1.21)
90
+ rufus-scheduler (~> 3.8.1)
91
+ zlib (~> 2.1.1)
92
+
93
+ BUNDLED WITH
94
+ 2.3.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Vasuki Narayana
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # Jfrog::Saas::Log::Collector
2
+
3
+ JFrog Saas Log Collector gem is intended for downloading and extracting of log files generated in Artifactory or Xray on the Jfrog Cloud.
4
+ The Log Collection feature on the cloud instance has to be [enabled](https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-EnableLogCollection) for this gem to perform the download and extract of the logs.
5
+
6
+ ## Installation
7
+
8
+ Prerequisite:
9
+
10
+ For Gem based install, Ruby Interpreter has to be setup first, following is the recommended process to install Ruby
11
+
12
+ ```text
13
+
14
+ 1. Install Ruby Version Manager (RVM) as described in https://rvm.io/rvm/install#installation-explained, ensure to follow all the onscreen instructions provided to complete the rvm installation
15
+ * For installation across users a SUDO based install is recommended, the installation is as described in https://rvm.io/support/troubleshooting#sudo
16
+
17
+ 2. Once rvm installation is complete, verify the RVM installation executing the command 'rvm -v'
18
+
19
+ 3. Now install ruby v2.7.0 or above executing the command 'rvm install <ver_num>', ex: 'rvm install 2.7.5'
20
+
21
+ 4. Verify the ruby installation, execute 'ruby -v', gem installation 'gem -v' and 'bundler -v' to ensure all the components are intact
22
+
23
+ 5. Post completion of Ruby, Gems installation, the environment is ready to further install new gems, execute the following gem install commands one after other to setup the needed ecosystem
24
+
25
+ ```
26
+ Install it:
27
+
28
+ $ gem install jfrog-saas-log-collector
29
+
30
+ Or add this line to your application's Gemfile:
31
+
32
+ ```ruby
33
+ gem 'jfrog-saas-log-collector'
34
+ ```
35
+
36
+ And then execute:
37
+
38
+ $ bundle install
39
+
40
+ ## Usage
41
+
42
+ Once the gem is successfully installed, use the gem to generate the sample config file,
43
+
44
+ $ jfrog-saas-log-collector -g <full_path_of_the_config_file>
45
+
46
+ example
47
+
48
+ $ jfrog-saas-log-collector -g /var/opt/jfrog/saas/sampleconfig.yaml
49
+
50
+ The config file sample would look like this,
51
+
52
+ ```yaml
53
+ connection:
54
+ jpd_url: "<saas_jpd_url>"
55
+ end_point_base: "artifactory"
56
+ username: "<admin_user>"
57
+ access_token: "<admin_access_token>"
58
+ open_timeout_in_secs: 20
59
+ read_timeout_in_secs: 60
60
+ log:
61
+ log_ship_config: "access/api/v1/logshipping/config"
62
+ solutions_enabled: ["artifactory", "xray"]
63
+ log_types_enabled: ["access-request", "router-request"]
64
+ uri_date_pattern: "%Y-%m-%d"
65
+ audit_repo: "artifactory/jfrog-logs-audit"
66
+ log_repo: "artifactory/jfrog-logs"
67
+ debug_mode: false
68
+ target_log_path: "<path_to_extract_logs_for_artifactory>"
69
+ print_with_utc: false
70
+ log_file_retention_days: 5
71
+ process:
72
+ parallel_process: 2
73
+ parallel_downloads: 5
74
+ historical_log_days: 2
75
+ write_logs_by_type: false
76
+ minutes_between_runs: 180
77
+ ```
78
+ Provide all the necessary values to the tags which have angular braces like "<saas_jpd_url>" to "https://example.jfrog.io", fill in for all other segments. Do not change any other values unless the operation associated with the other tag is understood well.
79
+ Once done, the jfrog-saas-log collector execution can be started by executing the command
80
+
81
+ $ jfrog-saas-log-collector -c <full_path_of_the_config_file>
82
+
83
+ example
84
+
85
+ $ jfrog-saas-log-collector -c /var/opt/jfrog/saas/sampleconfig.yaml
86
+
87
+ The gem records the progress or errors on the STDOUT / console and in a logfile (if the config provided is valid) which can be located at <path_to_extract_logs_for_artifactory>/jfrog-saas-collector.log
88
+
89
+ For all the options supported use
90
+
91
+ $ jfrog-saas-log-collector -h OR $ jfrog-saas-log-collector --help
92
+
93
+ ```shell
94
+ Usage: jfrog-saas-log-collector [options]
95
+ -h, --help Prints this help
96
+ -g, --generate=CONFIG Generates sample config file from template to target file provided
97
+ -c, --config=CONFIG Executes the jfrog-saas-log-collector with the config file provided
98
+ ```
99
+
100
+ ## Contributing
101
+
102
+ Bug reports are welcome on GitHub at https://github.com/jfrog/jfrog-saas-log-collector/issues.
103
+
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "jfrog/saas/log/collector"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "jfrog/saas/log/collector"
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jfrog
4
+ module Saas
5
+ module Log
6
+ module Collector
7
+ VERSION = '0.1.5'
8
+ end
9
+ end
10
+ end
11
+ end