Can you create a logstash configuration file for charon logs (strongswan). Here is an…
- User
Can you create a logstash configuration file for charon logs (strongswan). Here is an example of logs: "Feb 20 09:42:51 00[DMN] Starting IKE charon daemon Feb 20 09:42:51 00[LIB] plugin 'aes': loaded successfully Feb 20 09:42:51 00[LIB] plugin 'des': loaded successfully Feb 20 09:42:51 00[LIB] plugin 'rc2': loaded successfully Feb 20 09:42:51 00[LIB] plugin 'sha2': loaded successfully Feb 20 09:42:51 00[LIB] plugin 'sha1': loaded successfully Feb 20 09:42:51 00[LIB] plugin 'md5': loaded successfully Feb 20 09:42:51 00[LIB] plugin 'mgf1': loaded successfully Feb 20 09:42:51 00[LIB] plugin 'random': loaded successfully"
Parse these log in 3 elements : timestamp, subsystem of the deamon strongswan and a description. Here are all the subsytem: "Each logging message also has a source from which subsystem in the daemon the log came from:
app: applications other than daemons asn: Low-level encoding/decoding (ASN.1, X.509 etc.) cfg: Configuration management and plugins chd: CHILD_SA/IPsec SA dmn: Main daemon setup/cleanup/signal handling enc: Packet encoding/decoding encryption/decryption operations esp: libipsec library messages ike: IKE_SA/ISAKMP SA imc: Integrity Measurement Collector imv: Integrity Measurement Verifier job: Jobs queuing/processing and thread pool management knl: IPsec/Networking kernel interface lib: libstrongswan library messages mgr: IKE_SA manager, handling synchronization for IKE_SA access net: IKE network communication pts: Platform Trust Service tls: libtls library messages tnc: Trusted Network Connect"
Can you also rename all these subsystem in post processing with there appropriate names ?
- Assistant
- User
Explain me how the configuration works please
- Assistant
- User
I got the following error : " Pipeline error {:pipeline_id=>"main", :exception=>#<TypeError: no implicit conversion of Array into String>, :backtrace=>["org/jruby/RubyRegexp.java:963:in
initialize'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-mutate-3.5.6/lib/logstash/filters/mutate.rb:244:inblock in register'", "org/jruby/RubyArray.java:1863:ineach_slice'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-mutate-3.5.6/lib/logstash/filters/mutate.rb:232:inregister'", "org/logstash/config/ir/compiler/AbstractFilterDelegatorExt.java:75:inregister'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:232:inblock in register_plugins'", "org/jruby/RubyArray.java:1821:ineach'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:231:inregister_plugins'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:590:inmaybe_setup_out_plugins'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:244:instart_workers'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:189:inrun'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:141:inblock in start'"], "pipeline.sources"=>["/usr/share/logstash/pipeline/test.conf"]" - Assistant
The error you're seeing indicates a
TypeErrorthat is related to thegsubfield in themutatefilter not being properly formatted. This error comes from a RubyRegexp initialization, which suggests that the regular expression or replacement patterns in the gsub array might be causing issues. - User
Can you replace gsub function with rename function : " mutate { gsub => [ # Replace subsystem_abbr abbreviations with full names ["subsystem_abbr", "dmn", "Main daemon setup/cleanup/signal handling"], ["subsystem_abbr", "lib", "libstrongswan library messages"], ["subsystem_abbr", "app", "applications other than daemons"], ["subsystem_abbr", "asn", "Low-level encoding/decoding"], ["subsystem_abbr", "cfg", "Configuration management and plugins"], ["subsystem_abbr", "chd", "CHILD_SA/IPsec SA"], ["subsystem_abbr", "enc", "Packet encoding/decoding encryption/decryption operations"], ["subsystem_abbr", "esp", "libipsec library messages"], ["subsystem_abbr", "ike", "IKE_SA/ISAKMP SA"], ["subsystem_abbr", "imc", "Integrity Measurement Collector"], ["subsystem_abbr", "imv", "Integrity Measurement Verifier"], ["subsystem_abbr", "job", "Jobs queuing/processing and thread pool management"], ["subsystem_abbr", "knl", "IPsec/Networking kernel interface"], ["subsystem_abbr", "mgr", "IKE_SA manager, handling synchronization for IKE_SA access"], ["subsystem_abbr", "net", "IKE network communication"], ["subsystem_abbr", "pts", "Platform Trust Service"], ["subsystem_abbr", "tls", "libtls library messages"], ["subsystem_abbr", "tnc", "Trusted Network Connect"] ] }
- Assistant
- User
What configuration I have to write for the filebeat.yml in order to take one by one each line of charon logs to logstash ?
- Assistant
To send Charon logs to Logstash using Filebeat, you will need to set up a Filebeat configuration (
filebeat.yml) that points to your Charon log files and specifies Logstash as the output destination. Here's an example configuration: