microsoft-sentinel-log-analytics-logstash-output-plugin 2.0.0-java

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c1f0f44a5a497d5842616627c0bf4342203c8daa7cf9c5757977ddeac26d4dbc
4
+ data.tar.gz: 75c688ae19b24743860ab3ba9c7ed5b5773dea034ed8884803c779713bdd0397
5
+ SHA512:
6
+ metadata.gz: 9449e1386567038fe721e8854f7fce247b99ecddd8dbe49f5025b5165d9a25dcc37699246a10a5e9b63cb9d2001aee7370a3ca51237d75c6d0adf03d48550851
7
+ data.tar.gz: 90ed8915a47d15996287db4eb9abd88e48965b688c24db167a317649689c12e0b6930bfde0f20b83b88518b6a93b534ec582330ecffac5e4cc408237535ea47a
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # AUTOGENERATED BY THE GRADLE SCRIPT. EDITS WILL BE OVERWRITTEN.
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
5
+
6
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
7
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
8
+
9
+ if Dir.exist?(logstash_path) && use_logstash_source
10
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
11
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
12
+ end
data/README.md ADDED
@@ -0,0 +1,246 @@
1
+ # Microsoft Sentinel Output Plugin for Logstash
2
+
3
+ Microsoft Sentinel provides a new output plugin for Logstash. Use this output plugin to send any log via Logstash to the Microsoft Sentinel/Log Analytics workspace. This is done with the Log Analytics DCR-based API.
4
+ You may send logs to custom or standard tables.
5
+
6
+ Plugin version: v2.0.0
7
+ Released on: 2026-03-30
8
+
9
+ This plugin is currently in development and is free to use. We request and appreciate feedback from users.
10
+
11
+ ## Installation Instructions
12
+ 1) Install the plugin
13
+ 2) Create a sample file
14
+ 3) Create the required DCR-related resources
15
+ 4) Configure Logstash configuration file
16
+
17
+
18
+ ## 1. Install the plugin
19
+
20
+ Microsoft Sentinel provides Logstash output plugin to Log analytics workspace using DCR based logs API.
21
+
22
+ The plugin is published on [RubyGems](https://rubygems.org/gems/microsoft-sentinel-log-analytics-logstash-output-plugin). To install to an existing logstash installation, run `logstash-plugin install microsoft-sentinel-log-analytics-logstash-output-plugin`.
23
+
24
+ If you do not have a direct internet connection, you can install the plugin to another logstash installation, and then export and import a plugin bundle to the offline host. For more information, see [Logstash Offline Plugin Management instruction](<https://www.elastic.co/guide/en/logstash/current/offline-plugins.html>).
25
+
26
+ Microsoft Sentinel's Logstash output plugin supports the following versions
27
+ - 7.0 - 7.17.13
28
+ - 8.0 - 8.9
29
+ - 8.11 - 8.15
30
+ - 8.19.2
31
+ - 9.0.8
32
+ - 9.1.10
33
+ - 9.2.4 - 9.2.5
34
+
35
+ Please note that when using Logstash 8, it is recommended to disable ECS in the pipeline. For more information refer to [Logstash documentation.](<https://www.elastic.co/guide/en/logstash/8.4/ecs-ls.html>)
36
+
37
+ ## 2. Create a sample file
38
+ To create a sample file, follow the following steps:
39
+ 1) Copy the output plugin configuration below to your Logstash configuration file:
40
+ ```
41
+ output {
42
+ microsoft-sentinel-log-analytics-logstash-output-plugin {
43
+ create_sample_file => true
44
+ sample_file_path => "<enter the path to the file in which the sample data will be written>" #for example: "c:\\temp" (for windows) or "/var/log" for Linux.
45
+ }
46
+ }
47
+ ```
48
+ Note: make sure that the path exists before creating the sample file.
49
+ 2) Start Logstash. The plugin will collect up to 10 records to a sample.
50
+ 3) The file named "sampleFile<epoch seconds>.json" in the configured path will be created once there are 10 events to sample or when the Logstash process exited gracefully. (for example: "c:\temp\sampleFile1648453501.json").
51
+
52
+
53
+ ### Configurations:
54
+ The following parameters are optional and should be used to create a sample file.
55
+ - **create_sample_file** - Boolean, False by default. When enabled, up to 10 events will be written to a sample json file.
56
+ - **sample_file_path** - Number, Empty by default. Required when create_sample_file is enabled. Should include a valid path in which to place the sample file generated.
57
+
58
+ ### Complete example
59
+ 1. set the pipeline.conf with the following configuration:
60
+ ```
61
+ input {
62
+ generator {
63
+ lines => [ "This is a test log message"]
64
+ count => 10
65
+ }
66
+ }
67
+
68
+ output {
69
+ microsoft-sentinel-log-analytics-logstash-output-plugin {
70
+ create_sample_file => true
71
+ sample_file_path => "<enter the path to the file in which the sample data will be written>" #for example: "c:\\temp" (for windows) or "/var/log" for Linux.
72
+ }
73
+ }
74
+ ```
75
+
76
+ 2. the following sample file will be generated:
77
+ ```
78
+ [
79
+ {
80
+ "host": "logstashMachine",
81
+ "sequence": 0,
82
+ "message": "This is a test log message",
83
+ "ls_timestamp": "2022-10-29T13:19:28.116Z",
84
+ "ls_version": "1"
85
+ },
86
+ ...
87
+ ]
88
+ ```
89
+
90
+ ## 3. Create the required DCR-related resources
91
+ To configure Microsoft Sentinel Logstash plugin you first need to create the DCR-related resources. To create these resources, follow one of the following tutorials:
92
+ 1) To ingest the data to a custom table use [Tutorial - Send custom logs to Azure Monitor Logs (preview) - Azure Monitor | Microsoft Docs](<https://docs.microsoft.com/azure/azure-monitor/logs/tutorial-custom-logs>) tutorial. Note that as part of creating the table and the DCR you will need to provide the sample file that you've created in the previous section.
93
+ 2) To ingest the data to a standard table like Syslog or CommonSecurityLog use [Tutorial - Send custom logs to Azure Monitor Logs using resource manager templates - Azure Monitor | Microsoft Docs](<https://docs.microsoft.com/azure/azure-monitor/logs/tutorial-custom-logs-api>).
94
+
95
+ *Note:* The identity (service principal or managed identity) must have the **Monitoring Metrics Publisher** role on the target DCR:
96
+
97
+ ```
98
+ az role assignment create \
99
+ --assignee <object-id-of-identity> \
100
+ --role "Monitoring Metrics Publisher" \
101
+ --scope "/subscriptions/<sub-id>/resourceGroups/<rg>/providers/Microsoft.Insights/dataCollectionRules/<dcr-name>"
102
+ ```
103
+
104
+
105
+ ## 4. Configure the Output Plugin
106
+
107
+ Add the `microsoft-sentinel-log-analytics-logstash-output-plugin` block to the `output` section of your Logstash configuration file (e.g., `logstash.conf`). The plugin requires three values from your Azure DCR resources plus authentication credentials depending on your method.
108
+
109
+ ### Required Config Values (needed for all methods)
110
+
111
+ | Key | Description |
112
+ |---|---|
113
+ | `data_collection_endpoint` | Your DCE logsIngestion URI |
114
+ | `dcr_id` | The immutable ID of your Data Collection Rule |
115
+ | `stream_name` | The stream name from your DCR (e.g., `Custom-MyTableRawData_CL`) |
116
+
117
+ ---
118
+
119
+ ### Authentication Examples
120
+
121
+ The plugin auto-detects the auth method based on which config values are present.
122
+
123
+ #### Option 1: Client Secret (App Registration)
124
+
125
+ Provide `client_id`, `client_secret`, and `tenant_id` for your Azure App Registration / service principal.
126
+
127
+ ```
128
+ output {
129
+ microsoft-sentinel-log-analytics-logstash-output-plugin {
130
+ data_collection_endpoint => "https://<your-dce-name>.<region>.ingest.monitor.azure.com"
131
+ dcr_id => "dcr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
132
+ stream_name => "Custom-MyTableRawData_CL"
133
+ client_id => "<your-app-client-id>"
134
+ client_secret => "<your-app-client-secret>"
135
+ tenant_id => "<your-azure-tenant-id>"
136
+ }
137
+ }
138
+ ```
139
+
140
+
141
+ #### Option 2: Managed Identity
142
+
143
+ When running on an Azure VM with a system-assigned managed identity, omit `client_id`, `client_secret`, and `tenant_id`. The plugin will automatically use the VM's managed identity.
144
+
145
+ ```
146
+ output {
147
+ microsoft-sentinel-log-analytics-logstash-output-plugin {
148
+ data_collection_endpoint => "https://<your-dce-name>.<region>.ingest.monitor.azure.com"
149
+ dcr_id => "dcr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
150
+ stream_name => "Custom-MyTableRawData_CL"
151
+ }
152
+ }
153
+ ```
154
+
155
+ #### Option 3: Client Secret + Sovereign Cloud
156
+
157
+ To authenticate against a sovereign cloud, add `azure_cloud`. Supported values: `AzurePublicCloud` (default), `AzureUSGovernment`, `AzureChinaCloud`, `AzureGermanyCloud`.
158
+
159
+ ```
160
+ output {
161
+ microsoft-sentinel-log-analytics-logstash-output-plugin {
162
+ data_collection_endpoint => "https://<your-dce-ingestion-endpoint>"
163
+ dcr_id => "dcr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
164
+ stream_name => "Custom-MyTableRawData_CL"
165
+ client_id => "<your-app-client-id>"
166
+ client_secret => "<your-app-client-secret>"
167
+ tenant_id => "<your-tenant-id>"
168
+ azure_cloud => "AzureUSGovernment"
169
+ }
170
+ }
171
+ ```
172
+
173
+ #### Option 4: Managed Identity + Sovereign Cloud
174
+
175
+ ```
176
+ output {
177
+ microsoft-sentinel-log-analytics-logstash-output-plugin {
178
+ data_collection_endpoint => "https://<your-dce-ingestion-endpoint>"
179
+ dcr_id => "dcr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
180
+ stream_name => "Custom-MyTableRawData_CL"
181
+ azure_cloud => "AzureUSGovernment"
182
+ }
183
+ }
184
+ ```
185
+ ---
186
+ Security notice: We recommend not to implicitly state client_id, client_secret, tenant_id, data_collection_endpoint, and dcr_id in your Logstash configuration for security reasons.
187
+ It is best to store this sensitive information in a Logstash KeyStore as described here- ['Secrets Keystore'](<https://www.elastic.co/guide/en/logstash/current/keystore.html>)
188
+
189
+ ---
190
+
191
+ ## Full Pipeline Example
192
+
193
+ A complete `logstash.conf` using client secret auth with a Beats input:
194
+
195
+ ```
196
+ input {
197
+ beats {
198
+ port => 5044
199
+ }
200
+ }
201
+
202
+ filter {
203
+ }
204
+
205
+ output {
206
+ microsoft-sentinel-log-analytics-logstash-output-plugin {
207
+ data_collection_endpoint => "https://my-dce.eastus2-1.ingest.monitor.azure.com"
208
+ dcr_id => "dcr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
209
+ stream_name => "Custom-MyTableRawData_CL"
210
+ client_id => "619c1731-15ca-4403-9c61-xxxxxxxxxxxx"
211
+ client_secret => "xxxxxxxxxxxxxxxx"
212
+ tenant_id => "72f988bf-86f1-41af-91ab-xxxxxxxxxxxx"
213
+ }
214
+ }
215
+ ```
216
+ ---
217
+
218
+ ## Optional Config Values
219
+
220
+ | Key | Default | Description |
221
+ |---|---|---|
222
+ | `azure_cloud` | `AzurePublicCloud` | Azure cloud environment |
223
+ | `keys_to_keep` | *(all)* | Array of field names to send (subset filtering) |
224
+ | `max_retries_num` | `3` | Max retry attempts for failed sends |
225
+ | `initial_wait_time_seconds` | `1` | Initial backoff between retries |
226
+ | `max_graceful_shutdown_time_seconds` | `60` | Max wait for graceful shutdown |
227
+ | `max_waiting_time_for_batch_seconds` | `10` | Max wait before flushing a batch |
228
+ | `worker_sleep_time_millis` | `10` | Delay between worker iterations |
229
+ | `batcher_workers_count` | *(auto)* | Number of batcher threads |
230
+ | `sender_workers_count` | *(auto)* | Number of sender threads |
231
+ | `unifier_workers_count` | *(auto)* | Number of unifier threads |
232
+
233
+ ## Known issues
234
+
235
+ When using Logstash installed on a Docker image of Lite Ubuntu, the following warning may appear:
236
+
237
+ ```
238
+ java.lang.RuntimeException: getprotobyname_r failed
239
+ ```
240
+
241
+ To resolve it, use the following commands to install the *netbase* package within your Dockerfile:
242
+ ```
243
+ USER root
244
+ RUN apt install netbase -y
245
+ ```
246
+ For more information, see [JNR regression in Logstash 7.17.0 (Docker)](https://github.com/elastic/logstash/issues/13703).
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
@@ -0,0 +1,7 @@
1
+ # AUTOGENERATED BY THE GRADLE SCRIPT. EDITS WILL BE OVERWRITTEN.
2
+ # encoding: utf-8
3
+
4
+ # NOTE: Java plugin (no Ruby plugin class). This file exists only to ensure
5
+ # jar-dependencies loads the packaged jar into JRuby's classpath.
6
+ require "logstash-output-microsoft-sentinel-log-analytics-logstash-output-plugin_jars"
7
+ require "java"
@@ -0,0 +1,5 @@
1
+ # AUTOGENERATED BY THE GRADLE SCRIPT. EDITS WILL BE OVERWRITTEN.
2
+ # encoding: utf-8
3
+
4
+ require 'jar_dependencies'
5
+ require_jar('org.logstashplugins', 'logstash-output-microsoft-sentinel-log-analytics-logstash-output-plugin', '2.0.0')
@@ -0,0 +1,4 @@
1
+ # AUTOGENERATED BY THE GRADLE SCRIPT. EDITS WILL BE OVERWRITTEN.
2
+ # encoding: utf-8
3
+ require "logstash-output-microsoft-sentinel-log-analytics-logstash-output-plugin_jars"
4
+ require "java"
@@ -0,0 +1,22 @@
1
+ # AUTOGENERATED BY THE GRADLE SCRIPT. EDITS WILL BE OVERWRITTEN.
2
+ Gem::Specification.new do |s|
3
+ s.name = 'microsoft-sentinel-log-analytics-logstash-output-plugin'
4
+ s.version = '2.0.0'
5
+ s.licenses = ['Apache-2.0']
6
+ s.summary = 'Microsoft Sentinel Log Analytics output plugin'
7
+ s.description = 'Microsoft Sentinel provides a new output plugin for Logstash. Use this output plugin to send any log via Logstash to the Microsoft Sentinel/Log Analytics workspace. This is done with the Log Analytics DCR-based API.'
8
+ s.authors = ['Microsoft']
9
+ s.email = ['msg-ucp@service.microsoft.com']
10
+ s.platform = 'java'
11
+ s.require_paths = ['lib', 'vendor/jar-dependencies']
12
+
13
+ s.files = Dir["lib/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
14
+
15
+ # Special flag to let us know this is actually a logstash plugin
16
+ s.metadata = { 'logstash_plugin' => 'true', 'logstash_group' => 'output', 'java_plugin' => 'true'}
17
+
18
+ # Gem dependencies
19
+ s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
20
+ s.add_runtime_dependency 'jar-dependencies'
21
+ s.add_development_dependency 'logstash-devutils'
22
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: microsoft-sentinel-log-analytics-logstash-output-plugin
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: java
6
+ authors:
7
+ - Microsoft
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-03-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '1.60'
19
+ - - "<="
20
+ - !ruby/object:Gem::Version
21
+ version: '2.99'
22
+ name: logstash-core-plugin-api
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '1.60'
30
+ - - "<="
31
+ - !ruby/object:Gem::Version
32
+ version: '2.99'
33
+ - !ruby/object:Gem::Dependency
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ name: jar-dependencies
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ name: logstash-devutils
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: Microsoft Sentinel provides a new output plugin for Logstash. Use this
62
+ output plugin to send any log via Logstash to the Microsoft Sentinel/Log Analytics
63
+ workspace. This is done with the Log Analytics DCR-based API.
64
+ email:
65
+ - msg-ucp@service.microsoft.com
66
+ executables: []
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - Gemfile
71
+ - README.md
72
+ - VERSION
73
+ - lib/logstash-output-microsoft-sentinel-log-analytics-logstash-output-plugin_jars.rb
74
+ - lib/logstash/outputs/microsoft-sentinel-log-analytics-logstash-output-plugin.rb
75
+ - lib/logstash_registry.rb
76
+ - logstash-output-microsoft-sentinel-log-analytics-logstash-output-plugin.gemspec
77
+ - vendor/jar-dependencies/org/logstashplugins/logstash-output-microsoft-sentinel-log-analytics-logstash-output-plugin/2.0.0/logstash-output-microsoft-sentinel-log-analytics-logstash-output-plugin-2.0.0.jar
78
+ homepage:
79
+ licenses:
80
+ - Apache-2.0
81
+ metadata:
82
+ logstash_plugin: 'true'
83
+ logstash_group: output
84
+ java_plugin: 'true'
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ - vendor/jar-dependencies
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubygems_version: 3.3.26
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Microsoft Sentinel Log Analytics output plugin
105
+ test_files: []