sumologic-query 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4adfba9fe6b1417e51cfcd3e1b5697a8ed208687ae17e8a114716c71711cdc0
4
- data.tar.gz: 331efc0e06d844ea82fada1bf97d5a4183189b9330437e5aab03a8d145a30e57
3
+ metadata.gz: 045b4c6496e38a665e48c98c37beb3fbf95477f8af17f507725ccf882dc63076
4
+ data.tar.gz: fb5d931c84e347065ee258d0da508eaf3d2ab847dd978b33dd33151ee544939e
5
5
  SHA512:
6
- metadata.gz: bacec0ea516f5d0d8d5ba06ffe70887aefb9e4dc8df6fda259d21817d37ecbece1ed57f0806e3c61f1e3a5bc934c1adfb779048e1b57c3ba1ac121b6bb7a2392
7
- data.tar.gz: 0f6af034374a1b3f417437a8cb691246393161be4f1b194441afc61128c1bf75c239f537a90aab883ed724e84add224c393437a23ef0d3cd23e2596f01f2c665
6
+ metadata.gz: 8f943fba2e5cb46fff13aaec60c1a898284ca745f2e357cafb88b68c6d55e8fae29fcb617761c18da7898ef27e1903185b50c076052b33b2b0a1249459caecda
7
+ data.tar.gz: 77c6f9270a9874a442749834c7f89e3ced18769ec89735ceba3746e1a2d2bb37541d32a752f186b673b01e6da67ae82ed67eaa60804255494913d120d1ea19e2
data/CHANGELOG.md CHANGED
@@ -1,34 +1,15 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
3
+ All notable changes to this project are documented in [GitHub Releases](https://github.com/patrick204nqh/sumologic-query/releases).
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
6
 
8
- ## [1.0.0] - 2025-11-13
7
+ ## Releases
9
8
 
10
- ### Added
11
- - Initial release of sumologic-query CLI tool
12
- - Core `Sumologic::Client` class for Search Job API
13
- - Command-line interface with query, time range, and output options
14
- - Automatic job polling with 20-second intervals
15
- - Automatic pagination for large result sets (10K messages per request)
16
- - Support for multiple Sumo Logic deployments (us1, us2, eu, au)
17
- - Environment variable configuration (SUMO_ACCESS_ID, SUMO_ACCESS_KEY, SUMO_DEPLOYMENT)
18
- - Debug mode for troubleshooting (SUMO_DEBUG)
19
- - JSON output format with metadata
20
- - Zero external dependencies (stdlib only)
21
- - Comprehensive error handling and user-friendly messages
22
- - MIT license
23
- - Complete documentation and examples
9
+ - [v1.1.0](https://github.com/patrick204nqh/sumologic-query/releases/tag/v1.1.0) - Latest
10
+ - [v1.0.0](https://github.com/patrick204nqh/sumologic-query/releases/tag/v1.0.0) - Initial release
24
11
 
25
- ### Features
26
- - Query historical logs via Search Job API
27
- - Time range filtering (ISO 8601 format)
28
- - Message limiting
29
- - Timezone support
30
- - File or stdout output
31
- - 5-minute default timeout
32
- - Graceful cleanup of search jobs
12
+ ---
33
13
 
34
- [1.0.0]: https://github.com/patrick204nqh/sumologic-query/releases/tag/v1.0.0
14
+ **Note:** Release notes are automatically generated from commit messages and pull requests.
15
+ See [GitHub Releases](https://github.com/patrick204nqh/sumologic-query/releases) for detailed changelogs.
@@ -10,7 +10,9 @@ module Sumologic
10
10
  # Handles historical log queries with automatic polling and pagination
11
11
  class Client
12
12
  API_VERSION = 'v1'
13
- DEFAULT_POLL_INTERVAL = 20 # seconds
13
+ INITIAL_POLL_INTERVAL = 5 # seconds - start fast for small queries
14
+ MAX_POLL_INTERVAL = 20 # seconds - slow down for large queries
15
+ POLL_BACKOFF_FACTOR = 1.5 # increase interval by 50% each time
14
16
  DEFAULT_TIMEOUT = 300 # seconds (5 minutes)
15
17
  MAX_MESSAGES_PER_REQUEST = 10_000
16
18
 
@@ -94,7 +96,8 @@ module Sumologic
94
96
  def poll_until_complete(job_id, timeout: DEFAULT_TIMEOUT)
95
97
  uri = URI("#{@base_url}/search/jobs/#{job_id}")
96
98
  start_time = Time.now
97
- interval = DEFAULT_POLL_INTERVAL
99
+ interval = INITIAL_POLL_INTERVAL
100
+ poll_count = 0
98
101
 
99
102
  loop do
100
103
  raise TimeoutError, "Search job timed out after #{timeout} seconds" if Time.now - start_time > timeout
@@ -107,16 +110,25 @@ module Sumologic
107
110
  data = JSON.parse(response.body)
108
111
 
109
112
  state = data['state']
110
- log_info "Job state: #{state} (#{data['messageCount']} messages, #{data['recordCount']} records)"
113
+ msg_count = data['messageCount']
114
+ rec_count = data['recordCount']
115
+ log_info "Job state: #{state} (#{msg_count} messages, #{rec_count} records) [interval: #{interval}s]"
111
116
 
112
117
  case state
113
118
  when 'DONE GATHERING RESULTS'
119
+ elapsed = Time.now - start_time
120
+ log_info "Job completed in #{elapsed.round(1)} seconds after #{poll_count + 1} polls"
114
121
  return data
115
122
  when 'CANCELLED', 'FORCE PAUSED'
116
123
  raise Error, "Search job #{state.downcase}"
117
124
  end
118
125
 
119
126
  sleep interval
127
+ poll_count += 1
128
+
129
+ # Adaptive backoff: gradually increase interval for long-running jobs
130
+ # This reduces API calls while maintaining responsiveness for quick jobs
131
+ interval = [interval * POLL_BACKOFF_FACTOR, MAX_POLL_INTERVAL].min
120
132
  end
121
133
  end
122
134
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sumologic
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sumologic-query
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - patrick204nqh