Good morning all,
I am attempting to join some data together from a different index in logstash.
I have the following configuration file:
input {
beats {
port => 5044
}
}
filter {
elasticsearch {
hosts => ["https://SERVER:9200"]
user => USER
password => PASSWORD
index => 'wmibeat-*'
query => 'wmi.Win32_Computersystem.Model :* AND beat.hostname : %{[beat][hostname]}'
fields => { "wmi.Win32_Computersystem.Model" => Model }
ruby {
code => 'event.set("model", event.get("Model"))'
}
}
}
output {
elasticsearch {
hosts => ["https://SERVER:9200","https://SERVER:9200"]
truststore => "c:\cacerts"
truststore_password => "PASSWORD"
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
user => USER
password => PASSWORD
}
}
If I remove the ruby code the logstash server starts up, but right now I am getting the following error:
[2019-05-06T12:00:41,933][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, => at line 15, column 9 (byte 353) after filter {\n\telasticsearch {\n\t\thosts => ["https://SERVER:9200"]\n\t\tuser => USER\n\t\tpassword => PASSWORD\n\t\tindex => 'wmibeat-'\n\t\tquery => 'wmi.Win32_Computersystem.Model : AND beat.hostname : %{[beat][hostname]}'\n\t\tfields => { "wmi.Win32_Computersystem.Model" => Model }\n\t\t\truby ", :backtrace=>["C:/DLs/logstash-6.4.3/logstash-core/lib/logstash/compiler.rb:41:in
compile_imperative'", "C:/DLs/logstash-6.4.3/logstash-core/lib/logstash/compiler.rb:49:in
compile_graph'", "C:/DLs/logstash-6.4.3/logstash-core/lib/logstash/compiler.rb:11:inblock in compile_sources'", "org/jruby/RubyArray.java:2486:in
map'", "C:/DLs/logstash-6.4.3/logstash-core/lib/logstash/compiler.rb:10:incompile_sources'", "org/logstash/execution/AbstractPipelineExt.java:149:in
initialize'", "C:/DLs/logstash-6.4.3/logstash-core/lib/logstash/pipeline.rb:22:ininitialize'", "C:/DLs/logstash-6.4.3/logstash-core/lib/logstash/pipeline.rb:90:in
initialize'", "C:/DLs/logstash-6.4.3/logstash-core/lib/logstash/pipeline_action/create.rb:38:inexecute'", "C:/DLs/logstash-6.4.3/logstash-core/lib/logstash/agent.rb:309:in
block in converge_state'"]}
JSON of a WMIBEAT event:
{
"_index": "wmibeat-%{[@metadata][version]}-2019.04.26",
"_type": "doc",
"_id": "lbSXWW8B5HXUhqNmq8vW",
"_version": 1,
"_score": null,
"_source": {
"beat": {
"name": "PCNAME",
"hostname": "PCNAME"
},
"wmi": {
"Win32_quickfixengineering": [
{
"InstalledOn": "4/12/2019",
"Description": "Update",
"HotFixID": "KB4489192",
"InstalledBy": "NT AUTHORITY\\SYSTEM"
},
{
"InstalledOn": "4/22/2019",
"Description": "Update",
"HotFixID": "KB4480056",
"InstalledBy": "NT AUTHORITY\\SYSTEM"
},
{
"InstalledOn": "4/12/2019",
"Description": "Security Update",
"HotFixID": "KB4493478",
"InstalledBy": "NT AUTHORITY\\SYSTEM"
},
{
"InstalledOn": "4/12/2019",
"Description": "Security Update",
"HotFixID": "KB4493510",
"InstalledBy": "NT AUTHORITY\\SYSTEM"
},
{
"InstalledOn": "4/12/2019",
"Description": "Security Update",
"HotFixID": "KB4493509",
"InstalledBy": "NT AUTHORITY\\SYSTEM"
}
],
"Win32_Computersystem": [
{
"SystemType": "x64-based PC",
"Model": "HP EliteBook 840 G5",
"NumberOfLogicalProcessors": 8,
"SystemSKUNumber": "LOL",
"TotalPhysicalMemory": "17019641856",
"Manufacturer": "HP",
"NumberOfProcessors": 1,
"Domain": "domain.com"
}
],
"Win32_OperatingSystem": [
{
"BuildNumber": "17763",
"LastBootUpTime": "20190426071117.500000-300",
"LocalDateTime": "20190426072111.597000-300",
"Caption": "Microsoft Windows 10 Enterprise",
"InstallDate": "20190411113107.000000-300"
}
]
},
"@timestamp": "2019-04-26T12:21:11.983Z",
"@version": "1",
"type": "wmibeat",
"host": "PCNAME",
"tags": [
"beats_input_raw_event"
]
},
"fields": {
"@timestamp": [
"2019-04-26T12:21:11.983Z"
]
},
"highlight": {
"beat.hostname": [
"@kibana-highlighted-field@PCNAME@/kibana-highlighted-field@"
]
},
"sort": [
1556281271983
]
}
Here is the JSON event I want to append the model from the previous event:
{
"_index": "winlogbeat-6.4.3-2019.05.06",
"_type": "doc",
"_id": "6p6VjWoB5HXUhqNmJ2T9",
"_version": 1,
"_score": null,
"_source": {
"host": {
"name": "PCNAME"
},
"event_id": 62441,
"process_id": 9980,
"source_name": "Microsoft-Windows-Shell-Core",
"computer_name": "PCNAME.FQDN.COM",
"@version": "1",
"provider_guid": "{30336ed4-e327-447c-9de0-51b652c86108}",
"thread_id": 16588,
"record_number": "1843",
"model": null,
"level": "Information",
"event_data": {
"ProgId": "AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723",
"ExtOrUriScheme": ".pdf"
},
"user": {
"type": "User",
"domain": "DOMAIN",
"identifier": "SID",
"name": "ID"
},
"opcode": "Info",
"beat": {
"hostname": "PCNAME",
"version": "6.4.3",
"name": "PCNAME"
},
"message": "User choice has been reset to prog id AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723 for .pdf",
"log_name": "Microsoft-Windows-Shell-Core/AppDefaults",
"type": "wineventlog",
"tags": [
"beats_input_codec_plain_applied"
],
"@timestamp": "2019-05-06T14:38:40.183Z"
},
"fields": {
"@timestamp": [
"2019-05-06T14:38:40.183Z"
]
},
"highlight": {
"beat.hostname": [
"@kibana-highlighted-field@PCNAME@/kibana-highlighted-field@"
]
},
"sort": [
1557153520183
]
}
I feel like at this point, I have to be close.. can someone point me in the right direction please?
Thanks.