Giter Club home page Giter Club logo

fluent-plugin-windows-eventlog's Introduction

fluent-plugin-windows-eventlog

Component

fluentd Input plugin for the Windows Event Log

Fluentd plugin to read the Windows Event Log.

This repository contains 2 Fluentd plugins:

  • in_windows_eventlog
  • in_windows_eventlog2

The former one is obsolete, please don't use in newly deployment.

This document describes about the later one. If you want to know about the obsolete one, please see in_windows_eventlog(old).md

Installation

ridk exec gem install fluent-plugin-windows-eventlog

in_windows_eventlog2

Fluentd Input plugin for the Windows Event Log using newer Windows Event Logging API. This is successor to in_windows_eventlog. See also this slide for the details of in_windows_eventlog2 plugin.

Configuration

<source>
  @type windows_eventlog2
  @id windows_eventlog2
  channels application,system # Also be able to use `<subscribe>` directive.
  read_existing_events false
  read_interval 2
  tag winevt.raw
  render_as_xml false       # default is false.
  rate_limit 200            # default is -1(Winevt::EventLog::Subscribe::RATE_INFINITE).
  # preserve_qualifiers_on_hash true # default is false.
  # read_all_channels false # default is false.
  # description_locale en_US # default is nil. It means that system locale is used for obtaining description.
  # refresh_subscription_interval 10m # default is nil. It specifies refresh interval for channel subscriptions.
  # event_query "Event/System[EventID!=1001]" # default is "*".
  <storage>
    @type local             # @type local is the default.
    persistent true         # default is true. Set to false to use in-memory storage.
    path ./tmp/storage.json # This is required when persistent is true. If migrating from eventlog v1 please ensure that you remove the old .pos folder
                            # Or, please consider using <system> section's `root_dir` parameter.
  </storage>
  # <parse> # Note: parsing is only available when render_as_xml true
  #  @type winevt_xml # @type winevt_xml is the default. winevt_xml and none parsers are supported for now.
    # When set up it as true, this plugin preserves "Qualifiers" and "EventID" keys.
    # When set up it as false, this plugin calculates actual "EventID" from "Qualifiers" and removing "Qualifiers".
    # With the following equation:
    # (EventID & 0xffff) | (Qualifiers & 0xffff) << 16
    # preserve_qualifiers true # preserve_qualifiers_on_hash can be used as a setting outside <parse> if render_as_xml is false
  # </parse>
  # <subscribe>
  #   channles application, system
  #   read_existing_events false # read_existing_events should be applied each of subscribe directive(s)
  #   remote_server 127.0.0.1 # Remote server ip/fqdn
  #   remote_domain WORKGROUP # Domain name
  #   remote_username fluentd # Remoting access account name
  #   remote_password changeme! # Remoting access account password
  # </subscribe>
</source>

NOTE: in_windows_eventlog2 always handles EventLog records as UTF-8 characters. Users don't have to specify encoding related parameters and they are not provided.

NOTE: When Description contains error message such as The message resource is present but the message was not found in the message table., eventlog's resource file (.mui) related to error generating event is something wrong. This issue is also occurred in built-in Windows Event Viewer which is the part of Windows management tool.

NOTE: When render_as_xml as true, fluent-plugin-parser-winevt_xml plugin should be needed to parse XML rendered Windows EventLog string.

NOTE: If you encountered CPU or memory spike due to massively huge EventLog channel, rate_limit parameter may help you. This paramter can handle the multiples of 10 or -1(Winevt::EventLog::Subscribe::RATE_INFINITE).

parameters

name description
channels (option) No default value just empty array, but 'application' is used as default due to backward compatibility. One or more of {'application', 'system', 'setup', 'security'} and other evtx, which is the brand new Windows XML Event Log (EVTX) format since Windows Vista, formatted channels. Theoritically, in_windows_ventlog2 may read all of channels except for debug and analytical typed channels. If you want to read 'setup' or 'security' logs or some privileged channels, you must launch fluentd with administrator privileges.
keys (option) A subset of keys to read. Defaults to all keys.
read_interval (option) Read interval in seconds. 2 seconds as default.
<storage> Setting for storage plugin for recording read position like in_tail's pos_file.
<parse> Setting for parser plugin for parsing raw XML EventLog records.
parse_description (option) parse description field and set parsed result into the record. Description and EventData fields are removed
read_from_head Deprecated (option) Start to read the entries from the oldest, not from when fluentd is started. Defaults to false.
read_existing_events (option) Read the entries which already exist before fluentd is started. Defaults to false.
render_as_xml (option) Render Windows EventLog as XML or Ruby Hash object directly. Defaults to false.
rate_limit (option) Specify rate limit to consume EventLog. This is the approximate maximum number of records read per second. If more than this value is read in a second, this stops reading and waits until the next read_interval. This value must be a multiple of 10. Default is -1(Winevt::EventLog::Subscribe::RATE_INFINITE) and this means there is no upper limit. The log flow rate for setting this is approximately as follows: rate_limit / read_interval [logs/second]
preserve_qualifiers_on_hash (option) When set up it as true, this plugin preserves "Qualifiers" and "EventID" keys. When set up it as false, this plugin calculates actual "EventID" from "Qualifiers" and removing "Qualifiers". Default is false.
read_all_channels (option) Read from all channels. Default is false
description_locale (option) Specify description locale. Default is nil. See also: Supported locales
refresh_subscription_interval (option) It specifies refresh interval for channel subscriptions. Default is nil.
event_query (option) It specifies query for deny/allow/filter events with XPath 1.0 or structured XML query. Default is "*" (retrieving all events).
<subscribe> Setting for subscribe channels.

subscribe section

name description
channels One or more of {'application', 'system', 'setup', 'security'}. If you want to read 'setup' or 'security' logs, you must launch fluentd with administrator privileges.
read_existing_events (option) Read the entries which already exist before fluentd is started. Defaults to false.
remote_server (option) Remoting access server ip address/fqdn. Defaults to nil.
remote_domain (option) Remoting access server joining domain name. Defaults to nil.
remote_username (option) Remoting access access account's username. Defaults to nil.
remote_password (option) Remoting access access account's password. Defaults to nil.

Motivation: subscribe directive is designed for applying read_existing_events each of channels which is specified in subscribe section(s).

e.g) The previous configuration can handle read_existing_events but this parameter only specifies read_existing_events or not for channels which are specified in channels.

channels ["Application", "Security", "HardwareEvents"]
read_existing_events true

is interpreted as "Application", "Security", and "HardwareEvents" should be read existing events.

But some users want to configure to:

  • "Application" and "Security" channels just tailing
  • "HardwareEvent" channel read existing events before launching Fluentd

With <subscribe> directive, this requirements can be represendted as:

<subscribe>
  channels ["Application", "Security"]
  # read_existing_events false
</subscribe>
<subscribe>
  channels ["HardwareEvent"]
  read_existing_events true
</subscribe>

This configuration can be handled as:

  • "Application" and "Security" channels just tailing
  • "HardwareEvent" channel read existing events before launching Fluentd
Remoting access

<subscribe> section supports remoting access parameters:

  • remote_server
  • remote_domain
  • remote_username
  • remote_password

These parameters are only in <subscribe> directive.

Note that before using this feature, remoting access users should belong to "Event Log Readers" group:

> net localgroup "Event Log Readers" <domain\username> /add

And then, users also should set up their remote box's Firewall configuration:

> netsh advfirewall firewall set rule group="Remote Event Log Management" new enable=yes

As a security best practices, remoting access account should not be administrator account.

For graphical instructions, please refer to Preconfigure a Machine to Collect Remote Windows Events | Sumo Logic document for example.

Available keys

This plugin reads the following fields from Windows Event Log entries. Use the keys configuration option to select a subset. No other customization is allowed for now.

key
ProviderName
ProviderGuid
EventID
Qualifiers
Level
Task
Opcode
Keywords
TimeCreated
EventRecordId
ActivityID
RelatedActivityID
ProcessID
ThreadID
Channel
Computer
UserID
Version
Description
EventData

parse_description details

Here is an example with parse_description true.

{
  "ProviderName": "Microsoft-Windows-Security-Auditing",
  "ProviderGUID": "{D441060A-9695-472B-90BC-24DCA9D503A4}",
  "EventID": "4798",
  "Qualifiers": "",
  "Level": "0",
  "Task": "13824",
  "Opcode": "0",
  "Keywords": "0x8020000000000000",
  "TimeCreated": "2019-06-19T03:10:01.982940200Z",
  "EventRecordID": "87028",
  "ActivityID": "",
  "RelatedActivityID": "{2599DE71-2F70-44AD-9DC8-C5FF2AE8D1EF}",
  "ThreadID": "16888",
  "Channel": "Security",
  "Computer": "DESKTOP-TEST",
  "UserID": "",
  "Version": "0",
  "Description": "A user's local group membership was enumerated.\r\n\r\nSubject:\r\n\tSecurity ID:\t\tS-X-Y-Z\r\n\tAccount Name:\t\tDESKTOP-TEST$\r\n\tAccount Domain:\t\tWORKGROUP\r\n\tLogon ID:\t\t0x3e7\r\n\r\nUser:\r\n\tSecurity ID:\t\tS-XXX-YYY-ZZZ0\r\n\tAccount Name:\t\tAdministrator\r\n\tAccount Domain:\t\tDESKTOP-TEST\r\n\r\nProcess Information:\r\n\tProcess ID:\t\t0xbac\r\n\tProcess Name:\t\tC:\\Windows\\System32\\svchost.exe\r\n",
  "EventData": [
    "Administrator",
    "DESKTOP-TEST",
    "S-XXX-YYY-ZZZ",
    "S-X-Y-Z",
    "DESKTOP-TEST$",
    "WORKGROUP",
    "0x3e7",
    "0xbac",
    "C:\\Windows\\System32\\svchost.exe"
  ]
}

This record is transformed to

{
  "ProviderName": "Microsoft-Windows-Security-Auditing",
  "ProviderGUID": "{D441060A-9695-472B-90BC-24DCA9D503A4}",
  "EventID": "4798",
  "Qualifiers": "",
  "Level": "0",
  "Task": "13824",
  "Opcode": "0",
  "Keywords": "0x8020000000000000",
  "TimeCreated": "2019-06-19T03:10:01.982940200Z",
  "EventRecordID": "87028",
  "ActivityID": "",
  "RelatedActivityID": "{2599DE71-2F70-44AD-9DC8-C5FF2AE8D1EF}",
  "ThreadID": "16888",
  "Channel": "Security",
  "Computer": "DESKTOP-TEST",
  "UserID": "",
  "Version": "0",
  "DescriptionTitle": "A user's local group membership was enumerated.",
  "subject.security_id": "S-X-Y-Z",
  "subject.account_name": "DESKTOP-TEST$",
  "subject.account_domain": "WORKGROUP",
  "subject.logon_id": "0x3e7",
  "user.security_id": "S-XXX-YYY-ZZZ",
  "user.account_name": "Administrator",
  "user.account_domain": "DESKTOP-TEST",
  "process_information.process_id": "0xbac",
  "process_information.process_name": "C:\\Windows\\System32\\svchost.exe"
}

NOTE: This feature assumes description field has following formats:

  • group delimiter: \r\n\r\n
  • record delimiter: \r\n\t
  • field delimiter: \t\t

If your description doesn't follow this format, the parsed result is only description_title field with same description content.

Copyright

Copyright

Copyright(C) 2014- @okahashi117

License

Apache License, Version 2.0

fluent-plugin-windows-eventlog's People

Contributors

agup006 avatar ashie avatar bayetovsky avatar cadyb avatar cosmo0920 avatar daipom avatar dependabot[bot] avatar igorpeshansky avatar kenhys avatar okahashi117 avatar philipsabri avatar qingling128 avatar repeatedly avatar shvnks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fluent-plugin-windows-eventlog's Issues

Failure to open Windows Event Log results in Fluentd crash

[Version]
fluent-plugin-windows-eventlog-0.2.1

[Related Code]
When we failed to open Windows Event log file for some reason, the code still tried to close the nil object. Then Fluentd crashed.

[Error]

2019-08-18 07:13:24 -0500 [error]: #0 Unexpected error raised. Stopping the timer. title=:in_windows_eventlog_security error_class=NoMethodError error="undefined method `close' for nil:NilClass\nDid you mean?  clone"
  2019-08-18 07:13:24 -0500 [error]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.3.0/gems/fluent-plugin-windows-eventlog-0.2.1/lib/fluent/plugin/in_windows_eventlog.rb:184:in `ensure in on_notify'
  2019-08-18 07:13:24 -0500 [error]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.3.0/gems/fluent-plugin-windows-eventlog-0.2.1/lib/fluent/plugin/in_windows_eventlog.rb:184:in `on_notify'
  2019-08-18 07:13:24 -0500 [error]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.3.0/gems/fluent-plugin-windows-eventlog-0.2.1/lib/fluent/plugin/in_windows_eventlog.rb:113:in `block (2 levels) in start'
  2019-08-18 07:13:24 -0500 [error]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.3.0/gems/fluentd-1.2.5/lib/fluent/plugin_helper/timer.rb:80:in `on_timer'
  2019-08-18 07:13:24 -0500 [error]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.3.0/gems/cool.io-1.4.6-x86-mingw32/lib/cool.io/loop.rb:88:in `run_once'
  2019-08-18 07:13:24 -0500 [error]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.3.0/gems/cool.io-1.4.6-x86-mingw32/lib/cool.io/loop.rb:88:in `run'
  2019-08-18 07:13:24 -0500 [error]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.3.0/gems/fluentd-1.2.5/lib/fluent/plugin_helper/event_loop.rb:93:in `block in start'
  2019-08-18 07:13:24 -0500 [error]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.3.0/gems/fluentd-1.2.5/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'

windows_eventlog2 parsing problems

Hi everyone,

A while ago we started using the windows_eventlog2 for fetching server's logs on a big infrastructure.
The issue we're encountering at this point is that certain logs aren't being parsed properly to Elasticsearch (mapper_parsing_exception).

The logs that are encountering issues look like this:

{"ProviderName"=>"Microsoft-Windows-Security-Auditing",
"ProviderGUID"=>"{54849625-5478-4994-a5ba-3e3b0328c30d}",
"EventID"=>"4672",
"Level"=>"0",
"Task"=>"12548",
"Opcode"=>"0",
"Keywords"=>"0x8020000000000000",
"TimeCreated"=>"2019-10-22T16:00:01.885659600Z",
"EventRecordID"=>"328833",
"RelatedActivityID"=>"{fd2f1b03-7f96-0001-751b-2ffd967fd501}",
"ThreadID"=>"6592",
"Channel"=>"Security",
"Computer"=>"patch002.infra.be.sentia.cloud",
"Version"=>"0",
"DescriptionTitle"=>"Special privileges assigned to new logon.",
"subject.security_id"=>"S-1-5-21-2310396381-124451520-3033224903-1522",
"subject.account_name"=>"schtasks-patch002",
"subject.account_domain"=>"INFRA",
"subject.logon_id"=>"0x19296048",
"privileges"=>"SeSecurityPrivilege",
""=>"SeDelegateSessionUserImpersonatePrivilege"}

As you can see, the "privileges" field is most likely breaking the mapping.
Is there any possiblity to parse the privileges field to something else? Perhaps a comma-separated string?

Thanks in advance!

Warm regards,

Matti

unable to forward event logs

I'd like to forward the event logs of our Win2012 to Fluentd (on a linux server)
I used fluent-plugin-windows-eventlog but its not forwarding and the json file seems incomplete.

The json file output only contains
{"application":[15007,1],"system":[87037,41414],"security":[57655871,1]}

I was hoping to get something like:

{
"channel":"security",
"record_number":"91698",
"time_generated":"2017-08-29 20:12:29 +0000",
"time_written":"2017-08-29 20:12:29 +0000",

Attached config is what I'm using (not really sure of this config since fluentd is new to me)

Not able to retrieve Sysmon logs

I have multiple custom channels where Security and Sysmon logs are forwarded.

<source>
  @type windows_eventlog2
  @id wec_channels
  channels ["WEC-Security", "WEC-Sysmon"]
  read_interval 2
  rate_limit 5000
  tag wec_channels
  render_as_xml true
  parse_description false
  <storage>
    @type local
    persistent true
    path C:\opt\td-agent\var\log\wec_channels
  </storage>
  <parse>
    @type none
  </parse>
</source>

<match wec_channels>
  @type kinesis_streams
  ...
</match>

At first I was only receiving Security logs and the systems worked like a charm.

As soon as I add sysmon logs in the configuration, I see this behaviour:

The ruby process flushes correctly the first pass of the first security logs, and after that, the memory keeps on increasing without releasing the logs.
Sometimes, when I stop the service, it flushes the Sysmon logs and at other times it does not.

I can correctly query that sysmon channel through winevt and receive XML logs.
The message part is empty and the xml one contains line returns (in do |xml, message, string_inserts|).

I tried to mimic the plugin by editing the log handling with the purest form and removing the parser helper (I only need XML output).

    def on_notify_xml(ch, subscribe)
        ...
        subscribe.each do |xml, message, string_inserts|
          xml = xml.gsub(/[ \x00\t\n\v\f\r]+/, " ")
          log.debug "XML LOG (#{xml})"
          es.add(Fluent::Engine.now, { "message" => "#{xml}" })
        end
        ...

The sysmon logs are correctly written as debug messages to the td-agent.log file but they don't go anywhere after that.

I tried to use different workers, different sources, different output plugins, it just doesn't get to the match part, keeps stuck in the source part, keeping the logs in memory. If I remove the sysmon logs channel and add other ones, it all works fine.

The WEC servers are beasts and the quantity of security logs is higher than the sysmon ones, there is no system or network bottleneck.

Tried with td-agent version 4.1.1 and also 4.1.0 because I saw some memory leak issues.

Any suggestion?

render_as_xml does not work?

Hello FluentD team,

I am attempting to use FluentD to collect Windows event logs using the following configuration:

<source>
  @type windows_eventlog2
  @id windows_eventlog2
  channels application
  read_existing_events true
  tag winevt.raw
  render_as_xml true
  rate_limit 200
  <storage>
    @type local
    persistent true
    path C:\opt\td-agent\winlog.json
  </storage>
</source>

<match winevt.raw>
  @type stdout
</match>

The logs are printing to STDOUT as expected, however they are in JSON format. The only change I am seeing between using 'render_as_xml true' and 'render_as_xml false' is that the EventIDs are properly displayed with the value set to 'true'. Otherwise there is no change of the actual format of the log being printed to STDOUT. I have also tried adding a section to the config, with no effect.

What I am expecting to see is a log that looks something like this (Actual XML log from my system - fields changed to scrub my PID):

<Event xmlns=โ€œhttp://schemas.microsoft.com/win/2004/08/events/eventโ€>
 <System>
  <Provider Name=โ€œMicrosoft-Windows-Security-SPPโ€ Guid=โ€œ{00000000-C8C9-472C-A5F9-000000000000}โ€ EventSourceName=โ€œSoftware Protection Platform Serviceโ€ />
  <EventID Qualifiers=โ€œ16384โ€>16384</EventID>
  <Version>0</Version>
  <Level>4</Level>
  <Task>0</Task>
  <Opcode>0</Opcode>
  <Keywords>0x80000000000000</Keywords>
  <TimeCreated SystemTime=โ€œ2022-01-14T20:32:39.2460562Zโ€ />
  <EventRecordID>24551</EventRecordID>
  <Correlation />
  <Execution ProcessID=โ€œ0โ€ ThreadID=โ€œ0" />
  <Channel>Application</Channel>
  <Computer>DESKTOP-00000</Computer>
  <Security />
 </System>
 <EventData>
  <Data>2121-12-21T20:32:39Z</Data>
  <Data>RulesEngine</Data>
 </EventData>
</Event>

and NOT like this:

2022-01-14 14:20:31.395438200 -0700 winevt.raw: {โ€œProviderNameโ€:โ€œMicrosoft-Windows-Security-SPPโ€,โ€œProviderGUIDโ€:โ€œโ€,โ€œEventIDโ€:โ€œ16384",โ€œLevelโ€:โ€œ4",โ€œTaskโ€:โ€œ0",โ€œOpcodeโ€:โ€œ0",โ€œKeywordsโ€:โ€œ0x80000000000000",โ€œTimeCreatedโ€:โ€œ2022/01/14 20:32:39.246056200",โ€œEventRecordIDโ€:โ€œ24551",โ€œActivityIDโ€:โ€œโ€,โ€œRelatedActivityIDโ€:โ€œโ€,โ€œProcessIDโ€:โ€œ0",โ€œThreadIDโ€:โ€œ0",โ€œChannelโ€:โ€œApplicationโ€,โ€œComputerโ€:โ€œDESKTOP-00000โ€,โ€œUserIDโ€:โ€œโ€,โ€œVersionโ€:โ€œ0",โ€œDescriptionโ€:โ€œSuccessfully scheduled Software Protection service for re-start at 2121-12-21T20:32:39Z. Reason: RulesEngine.โ€œ,โ€EventDataโ€:[โ€œ2121-12-21T20:32:39Zโ€,โ€œRulesEngineโ€]}

My question is this: Is this feature bugged? Or is it possibly just mis-named?

Thank you.

windows_eventlog2 invalid/corrupt output

Describe the bug

Possible buffer overflow? Original issue posted on the Fluentd Google Group showed there were unexpected CJK characters in event logs. Upon further investigation these are not CJK characters, but rather botched unicode bytes appended to the original text after the "end of text" character. This leads me to believe the windows_eventlog2 plugin may be reading past the desired bytes in memory and grabbing extra data.

Here is how it looks:
"Description":"The resource loader failed to find MUI file.
ใณใˆธโ€ง็‰็•ƒ็‰ฒๆนฅใตด็ง็•ฒโฅใธฏเจโผผๆฝ‚ๆญฏๆ…ญๆญฒๆฅŒ็‘ณ>>ไๆถ”ๅ€€่€…ไˆผๆฝฏๆตซ็‰กไฑซ็ฉในดเจโ€ ไˆผๆฝฏๆตซ็‰กโซๆกƒๆนกๆ•ฎใตฌๆดงๆฉๆฝฒๆฝณ็‘ฆ็œญๆนฉๆฝค็ทๆฌญ็‰ฅๆ•ฎโตฌๆนฐโฝฐๆฝฃๆ™ฎๆฉ็‰ต็‘กๆฝฉโฎๅˆ ๆฅ็‰ฏไฅคใตคใˆงใฑโœฑไค ไณ็‰ตๆ•ฒ็‘ฎโœฝ็‰ดๆ•ตโผงเดพใฐŠไˆฏๆฝฏๆตซ็‰กไฑซ็ฉในดใธ€",

To Reproduce

Configure Fluentd to read all event logs with "read_all_channels true". This does not occur on the top-level Application, System, and Security logs. Coonfigure the match to dump all output to a local json file for convenience.
In the below code I had already narrowed it down to the wer-payloadhealth log, but that may not be consistent on every system, which is why I recommended using "read_all_channels true".

<source>
  @type windows_eventlog2
  @id windows_eventlog2
  channels "microsoft-windows-wer-payloadhealth/operational"
  preserve_qualifiers_on_hash true
  read_existing_events
  read_interval 10
  tag winevt.raw2
  render_as_xml false
  rate_limit 5000
  <storage>
    @type local
    persistent true
    path "C:/Program Files/appname/Fluentd/pos/winevt2.json"
  </storage>

</source>

<match winevt.raw2>
  @type file
  path "C:/Temp/${tag}.%Y%m%d%H%M"
  path_suffix ".json"
  append true
  <format>
    @type json
  </format>
  <buffer tag,time>
    timekey 1m
    timekey_use_utc true
    timekey_wait 1m
    chunk_limit_size 500MB
	flush_thread_count 2
  </buffer>
</match>

Expected behavior

The output json file will contain numerous Description elements with what appears to be CJK text. Many if not all will be associated with the what should be an empty Description.
The corresponding Description in Windows will likely be "The Description for event ID xx .... cannot be found."

Grab a Description text from the log and run it through a converter, such as the C# below:

string originalString = "paste string here";

foreach (char c in originalString)
{
byte[] utf8Bytes = Encoding.Unicode.GetBytes(c.ToString());
Console.WriteLine($"{(int)c} - { Encoding.UTF8.GetString(utf8Bytes)}");
}

EDIT the 3 printed below is actually "13" (carriage return).
Something that stands out is the "3", which is the "end of text" character. For now I can add a check to that in my code to signify what is valid text.
You can see after it gets past "10", the line feed character, everything goes a bit wonky.

Here is a snippet of the output:
Colums are Integer value - character

77 - M
85 - U
73 - I
32 -
102 - f
105 - i
108 - l
101 - e
46 - .
3 -
10 -

13363 - 34
12856 - 82
8231 - '
29513 - Is
30019 - Cu
29298 - rr
28261 - en
15732 - t=
29735 - 't
30066 - ru
10085 - e'
15919 - />
2573 -

Your Environment

- Fluentd version: 1.11.1 and 1.12.3
- TD Agent version: 3.8.1 and 4.1.1
- Operating system: Windows Server 2019 and Windows 10 Pro
- Kernel version:

Your Configuration

<source>
  @type windows_eventlog2
  @id windows_eventlog2
  channels "microsoft-windows-wer-payloadhealth/operational"
  preserve_qualifiers_on_hash true
  read_existing_events
  read_interval 10
  tag winevt.raw2
  render_as_xml false
  rate_limit 5000
  <storage>
    @type local
    persistent true
    path "C:/Program Files/appname/Fluentd/pos/winevt2.json"
  </storage>

</source>

<match winevt.raw2>
  @type file
  path "C:/Temp/${tag}.%Y%m%d%H%M"
  path_suffix ".json"
  append true
  <format>
    @type json
  </format>
  <buffer tag,time>
    timekey 1m
    timekey_use_utc true
    timekey_wait 1m
    chunk_limit_size 500MB
	flush_thread_count 2
  </buffer>
</match>

Your Error Log

No errors.

Additional context

No response

Missing UserData section from Applocker logs.

Hi, I have configured the windows_eventlog2 plugin in order to obtain applocker logs from my windows machines.

Specifically, I have configured fluentd 3.5.1.0 stable to get the microsoft-windows-applocker/exe and dll channel, and everything works as expected for the System section of the log, i.e. I am able to see attributes like: provider, eventId, etc. However, I can not see any of the UserData section attributes, for instance, FileHash or FileHashLength. Am I doing something wrong or is this a missing feature / known limitation?

Thanks a lot!

"The specified module could not be found" when using windows_eventlog2

Everything works when using the example windows_eventlog config but not when im using my own or the example windows_eventlog2 config.

plugin versions:

winevt_c' 0.8.1
fluent-plugin-windows-eventlog 0.7.0

Tried on Windows 10 and Windows Server 2019

Errorlog:

C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': 126: The specified module could not be found.   - C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/winevt_c-0.8.1/lib/winevt/winevt.so (LoadError)
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/winevt_c-0.8.1/lib/winevt.rb:4:in `rescue in <top (required)>'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/winevt_c-0.8.1/lib/winevt.rb:1:in `<top (required)>'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.7.0/lib/fluent/plugin/in_windows_eventlog2.rb:1:in `<top (required)>'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/registry.rb:102:in `block in search'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/registry.rb:99:in `each'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/registry.rb:99:in `search'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/registry.rb:44:in `lookup'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin.rb:155:in `new_impl'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin.rb:105:in `new_input'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/root_agent.rb:312:in `add_source'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/root_agent.rb:158:in `block in configure'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/root_agent.rb:152:in `each'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/root_agent.rb:152:in `configure'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/engine.rb:105:in `configure'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/engine.rb:80:in `run_configure'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/supervisor.rb:551:in `run_supervisor'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/command/fluentd.rb:330:in `<top (required)>'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/bin/fluentd:8:in `<top (required)>'
        from C:/opt/td-agent/bin/fluentd:23:in `load'
        from C:/opt/td-agent/bin/fluentd:23:in `<main>'

MSI built with https://github.com/clear-code/td-agent-builder

Because everything works with in_windows_eventlog something might be wrong between in_windows_eventlog2 and winevent_c

Scriptblock from powershell in DescriptionTitle escaping json value

We noticed our Elastic couldnt parse some logs coming from the Powershell channel, and after some investigation and getting the clean json log directly from windows_eventlog2 and file output we could clearly see its the parser from this plugin that makes them escape the json value, or not putting them inside the right key at all.

Example log:

{
    "ProviderName": "Microsoft-Windows-PowerShell",
    "ProviderGUID": "{A0C1853B-5C40-4B15-8766-3CF1C58F985A}",
    "EventID": "4104",
    "Qualifiers": "",
    "Level": "3",
    "Task": "2",
    "Opcode": "15",
    "Keywords": "0x0",
    "TimeCreated": "2020-08-05T08:54:21.118916000Z",
    "EventRecordID": "22338",
    "ActivityID": "{4FC9EF57-59A7-0001-26CA-FA52A759D601}",
    "RelatedActivityID": "",
    "ProcessID": "14424",
    "ThreadID": "13956",
    "Channel": "Microsoft-Windows-PowerShell/Operational",
    "Computer": "x",
    "UserID": "x",
    "Version": "1",
    "DescriptionTitle": "Creating Scriptblock text (1 of 1):\r\n#==========================================\r\n# Configuration\r\n#==========================================",
    "#==========================================\r\n#_function_exitreport\r\n#==========================================\r\nfunction_exitreport_($status,_$result)\r\n.write-host_($status_+_\":\"_+_$result_+": "\"`n\")",
    "if_($compare_-eq_\"critical\"_-or_$current_-eq_\"critical\")\r\n____": [
      "Return \"CRITICAL\""
    ],
    "elseif_($compare_-eq_\"warning\"_-or_$current_-eq_\"warning\")\r\n____": [
      "Return \"WARNING\""
    ],
    "elseif_($compare_-eq_\"unknown\"_-or_$current_-eq_\"unknown\")\r\n____": [
      "Return \"UNKNOWN\""
    ],
    "else\r\n": [
      "Return \"OK\""
    ],
    "time": "2020-08-05T08:54:21.118916000Z",
    "fluentd_host": "x",
    "infra_elastic_msg_id": "x"
  }

We can cleary see that "elseif_($compare_-eq_\"unknown\"_-or_$current_-eq_\"unknown\")\r\n____" is a json key when it looks like it should be in the DescriptionTitle, or might even have its own key named ScriptBlockText after watching th eventviewer xml.

Event in the eventviewer XML:

<Event
    xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
        <Provider Name="Microsoft-Windows-PowerShell" Guid="{A0C1853B-5C40-4B15-8766-3CF1C58F985A}" />
        <EventID>4104</EventID>
        <Version>1</Version>
        <Level>3</Level>
        <Task>2</Task>
        <Opcode>15</Opcode>
        <Keywords>0x0</Keywords>
        <TimeCreated SystemTime="2020-08-05T08:54:21.118916000Z" />
        <EventRecordID>22338</EventRecordID>
        <Correlation ActivityID="{4FC9EF57-59A7-0001-26CA-FA52A759D601}" />
        <Execution ProcessID="14424" ThreadID="13956" />
        <Channel>Microsoft-Windows-PowerShell/Operational</Channel>
        <Computer>x</Computer>
        <Security UserID="S-1-5-18" />
    </System>
    <EventData>
        <Data Name="MessageNumber">1</Data>
        <Data Name="MessageTotal">1</Data>
        <Data Name="ScriptBlockText">#========================================== # Configuration #========================================== <# $ConfWindowsUpdateSettings = 'Name;Value WUServer;http://x:x WUStatusServer;http://x:x TargetGroupEnabled;1 DoNotConnectToWindowsUpdateInternetLocations;0 ' | ConvertFrom-Csv -Delimiter ";" #> $ConfWindowsUpdateSettings = 'Name;Value WUServer;http://x:x WUStatusServer;http://x:x TargetGroupEnabled;1 ' | ConvertFrom-Csv -Delimiter ";" $WarnMissingUpdates = 10 $CritMissingUpdates = 20 $WarnLastInstallDate = -30 $CritLastInstallDate = -60 $Result = "" $Status = "OK" $PerfStats = "" #========================================== # Function Exit_State #========================================== Function Exit_State ($Status) { Switch ($Status) { "OK" {Return 0} "WARNING" {Return 1} "CRITICAL" {Return 2} "UNKNOWN" {Return 3} } } #========================================== # Function ExitReport #========================================== Function ExitReport ($Status, $Result) { Write-Host ($Status + ":" + $Result + "`n") Exit [int](Exit_State $Status) } #========================================== # Function Max_State #========================================== Function Max_State ($Current, $Compare) { If ($Compare -eq "CRITICAL" -or $Current -eq "CRITICAL") { Return "CRITICAL" } ElseIf ($Compare -eq "WARNING" -or $Current -eq "WARNING") { Return "WARNING" } ElseIf ($Compare -eq "UNKNOWN" -or $Current -eq "UNKNOWN") { Return "UNKNOWN" } Else { Return "OK" } } #Status examples #$Status = Max_State $Status "OK" #$Status = Max_State $Status "WARNING" #$Status = Max_State $Status "CRITICAL" #$Status = Max_State $Status "UNKNOWN" #========================================== # Main #========================================== $Error.Clear() # Verify Windows Update Settings $TempResult = $null $WindowsUpdateSettings = Get-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" foreach ($Setting in $ConfWindowsUpdateSettings) { If ($WindowsUpdateSettings.($Setting.Name) -ne $Setting.Value) { $Status = Max_State $Status "WARNING" $TempResult += ("{0}," -f $Setting.Name) } } If ($TempResult) { $Result += " Settings: {0};" -f $TempResult.TrimEnd(",") } Else { $Result += " Settings: OK;" } # Verify service not disabled $wuauserv = Get-Service -Name wuauserv if ($wuauserv.StartType -eq "Disabled") { Set-Service -Name wuauserv -StartupType Manual } #<# # Get update information from Microsoft update $UpdateSession = New-Object -ComObject 'Microsoft.Update.Session' $UpdateSearcher = $UpdateSession.CreateUpdateSearcher() $SearchResult = $UpdateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0") $HistoryCount = $UpdateSearcher.GetTotalHistoryCount() $UpdateHistory = $UpdateSearcher.QueryHistory(0,$HistoryCount) $MissingUpdates = ($SearchResult.Updates | Where-Object {$_.Title -notlike '*Definition Update*' -and $_.Description -notlike '*Install this update to revise the files that are used to detect viruses, spyware, and other potentially unwanted software.*'} | Measure-Object | Select-Object -ExpandProperty Count) $LastInstallDate = (Get-Date ($UpdateHistory | Sort-Object -Descending -Property Date | Where-Object {$_.Title -notlike 'Definition Update *' -and $_.Description -notlike '*Install this update to revise the files that are used to detect viruses, spyware, and other potentially unwanted software.*'} | Select-Object -First 1 -ExpandProperty Date) -Format "yyyy-MM-dd HH:mm:ss") #$LastInstallTitle = ($UpdateHistory | Sort-Object -Descending -Property Date | Where-Object {$_.Title -notlike 'Definition Update *'} | Select-Object -First 1 -ExpandProperty Title) #> # Verify missing count $Result += " Missing: {0};" -f $MissingUpdates $PerfStats += "Missing={0};{1};{2} " -f $MissingUpdates, $WarnMissingUpdates, $CritMissingUpdates If ($MissingUpdates -ge $CritMissingUpdates) { $Status = Max_State $Status "CRITICAL" } ElseIf ($MissingUpdates -ge $WarnMissingUpdates) { $Status = Max_State $Status "WARNING" } # Verify last install date $Result += " Last: {0}" -f (Get-Date $LastInstallDate -Format "yyyy-MM-dd") If ([datetime]$LastInstallDate -lt (Get-Date).AddDays($CritLastInstallDate)) { $Status = Max_State $Status "CRITICAL" } ElseIf ([datetime]$LastInstallDate -lt (Get-Date).AddDays($WarnLastInstallDate)) { $Status = Max_State $Status "WARNING" } # Check for errors If ($Error.Count -gt 0) { $Status = Max_State $Status "UNKNOWN" $Result += "; Errors: {0}" -f $Error.Count #$Error | Out-File -FilePath C:\x.txt -Append } #========================================== # Exit and Report #========================================== $Result += "|" + $PerfStats ExitReport $Status $Result
        </Data>
        <Data Name="ScriptBlockId">acad77d5-f5ce-414b-96de-ea6f78ba3021</Data>
        <Data Name="Path">C:\Program Files\x</Data>
    </EventData>
    <RenderingInfo Culture="en-US">
        <Message>Creating Scriptblock text (1 of 1): #========================================== # Configuration #========================================== <# $ConfWindowsUpdateSettings = 'Name;Value WUServer;http://x:x WUStatusServer;http://x:x TargetGroupEnabled;1 DoNotConnectToWindowsUpdateInternetLocations;0 ' | ConvertFrom-Csv -Delimiter ";" #> $ConfWindowsUpdateSettings = 'Name;Value WUServer;http://x:x WUStatusServer;http://x:x TargetGroupEnabled;1 ' | ConvertFrom-Csv -Delimiter ";" $WarnMissingUpdates = 10 $CritMissingUpdates = 20 $WarnLastInstallDate = -30 $CritLastInstallDate = -60 $Result = "" $Status = "OK" $PerfStats = "" #========================================== # Function Exit_State #========================================== Function Exit_State ($Status) { Switch ($Status) { "OK" {Return 0} "WARNING" {Return 1} "CRITICAL" {Return 2} "UNKNOWN" {Return 3} } } #========================================== # Function ExitReport #========================================== Function ExitReport ($Status, $Result) { Write-Host ($Status + ":" + $Result + "`n") Exit [int](Exit_State $Status) } #========================================== # Function Max_State #========================================== Function Max_State ($Current, $Compare) { If ($Compare -eq "CRITICAL" -or $Current -eq "CRITICAL") { Return "CRITICAL" } ElseIf ($Compare -eq "WARNING" -or $Current -eq "WARNING") { Return "WARNING" } ElseIf ($Compare -eq "UNKNOWN" -or $Current -eq "UNKNOWN") { Return "UNKNOWN" } Else { Return "OK" } } #Status examples #$Status = Max_State $Status "OK" #$Status = Max_State $Status "WARNING" #$Status = Max_State $Status "CRITICAL" #$Status = Max_State $Status "UNKNOWN" #========================================== # Main #========================================== $Error.Clear() # Verify Windows Update Settings $TempResult = $null $WindowsUpdateSettings = Get-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" foreach ($Setting in $ConfWindowsUpdateSettings) { If ($WindowsUpdateSettings.($Setting.Name) -ne $Setting.Value) { $Status = Max_State $Status "WARNING" $TempResult += ("{0}," -f $Setting.Name) } } If ($TempResult) { $Result += " Settings: {0};" -f $TempResult.TrimEnd(",") } Else { $Result += " Settings: OK;" } # Verify service not disabled $wuauserv = Get-Service -Name wuauserv if ($wuauserv.StartType -eq "Disabled") { Set-Service -Name wuauserv -StartupType Manual } #<# # Get update information from Microsoft update $UpdateSession = New-Object -ComObject 'Microsoft.Update.Session' $UpdateSearcher = $UpdateSession.CreateUpdateSearcher() $SearchResult = $UpdateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0") $HistoryCount = $UpdateSearcher.GetTotalHistoryCount() $UpdateHistory = $UpdateSearcher.QueryHistory(0,$HistoryCount) $MissingUpdates = ($SearchResult.Updates | Where-Object {$_.Title -notlike '*Definition Update*' -and $_.Description -notlike '*Install this update to revise the files that are used to detect viruses, spyware, and other potentially unwanted software.*'} | Measure-Object | Select-Object -ExpandProperty Count) $LastInstallDate = (Get-Date ($UpdateHistory | Sort-Object -Descending -Property Date | Where-Object {$_.Title -notlike 'Definition Update *' -and $_.Description -notlike '*Install this update to revise the files that are used to detect viruses, spyware, and other potentially unwanted software.*'} | Select-Object -First 1 -ExpandProperty Date) -Format "yyyy-MM-dd HH:mm:ss") #$LastInstallTitle = ($UpdateHistory | Sort-Object -Descending -Property Date | Where-Object {$_.Title -notlike 'Definition Update *'} | Select-Object -First 1 -ExpandProperty Title) #> # Verify missing count $Result += " Missing: {0};" -f $MissingUpdates $PerfStats += "Missing={0};{1};{2} " -f $MissingUpdates, $WarnMissingUpdates, $CritMissingUpdates If ($MissingUpdates -ge $CritMissingUpdates) { $Status = Max_State $Status "CRITICAL" } ElseIf ($MissingUpdates -ge $WarnMissingUpdates) { $Status = Max_State $Status "WARNING" } # Verify last install date $Result += " Last: {0}" -f (Get-Date $LastInstallDate -Format "yyyy-MM-dd") If ([datetime]$LastInstallDate -lt (Get-Date).AddDays($CritLastInstallDate)) { $Status = Max_State $Status "CRITICAL" } ElseIf ([datetime]$LastInstallDate -lt (Get-Date).AddDays($WarnLastInstallDate)) { $Status = Max_State $Status "WARNING" } # Check for errors If ($Error.Count -gt 0) { $Status = Max_State $Status "UNKNOWN" $Result += "; Errors: {0}" -f $Error.Count #$Error | Out-File -FilePath C:\x.txt -Append } #========================================== # Exit and Report #========================================== $Result += "|" + $PerfStats ExitReport $Status $Result ScriptBlock ID: acad77d5-f5ce-414b-96de-ea6f78ba3021 Path: C:\x
        </Message>
        <Level>Warning</Level>
        <Task>Execute a Remote Command</Task>
        <Opcode>On create calls</Opcode>
        <Channel>Microsoft-Windows-PowerShell/Operational</Channel>
        <Provider />
        <Keywords />
    </RenderingInfo>
</Event>

Also as we see here, there is a lot of information missing in the ScriptBlockText when fluentd picking it up

fluentd config:

<source>
    @type                           windows_eventlog2
    @id                             windows_eventlog2_0
    read_interval                   1
    tag                             x
    rate_limit                      200
    channels                        x
    parse_description               true
    render_as_xml                   true
    description_locale		    en_US
    <storage>   
        @type                       local
        persistent                  true
        path                        x
    </storage>
</source>

Wrong timeformat in newer versions

I've just noticed with the newer windows-eventlog2 versions there is a new timeformat, and I havent found a way to change it back with ruby in record_transformer yet.

td-agent versions >= 3.8.0
winevt_c 0.8.1
fluent-plugin-parser-winevt_xml 0.2.2
fluent-plugin-windows-eventlog 0.7.0

Will generate this. notice the forwardslashes->"TimeCreated":"2020/07/02 13:04:55.639000800"

td-agent version <= 3.7.1
winevt_c 0.7.3
fluent-plugin-windows-eventlog 0.5.4

This is how it used to be -> "TimeCreated":"2020-06-25T12:19:22.830140600Z"

Environment:
OS Name Microsoft Windows Server 2019 Standard
Version 10.0.17763 Build 17763

Incorrect / misleading documentation for in_windows_eventlog2 channels parameter

The in_windows_eventlog2 documentation says that there are only 4 valid logs / channels, however that is not true.

One or more of {'application', 'system', 'setup', 'security'}.

This implies that these are the only options, and that channels such as Microsoft-Windows-DiskDiagnostic/Operational are not supported.

I actually rejected fluentd as a logging solution based on the above documentation after a only brief test, and have been stuck fighting logstash config syntax.

However, @fifofonix showed me that all the windows log channels are supported.

<source>
  @type windows_eventlog2
  @id windows_eventlog2
  # Do not quote "" or escape \ characters in channel names...
  channels application,system,security,HardwareEvents,Windows PowerShell, Microsoft-Windows-Diagnosis-PCW/Operational 
</source>

It's too late for me, but if you hurry you can save countless others!

read_from_head activates if you close fluentd too soon

I added 100+ eventlog channels but some of them have very low activity, so when fluentd starts, it wont add a RecordID in the storage file to the channels that havent logged anything yet.
When restarting fluentd, it will read from the head on the channels that does not have a RecordID in the storage file. Is there anyway to fix this?

Config:

<source>
	@type			windows_eventlog2
	@id			windows_eventlog2
	channels		["..."]
	render_as_xml		true
	rate_limit		250
	parse_description	true
	read_from_head	     	false
	
	<storage>
		@type		local
		persistent	true
		path		c:/opt/tmp/storage.json
	</storage>	
	<parse>
		@type		winevt_xml
	</parse>
</source>	

Forwarded events

I am installing the agent on a WEC (Windows Event Collector) and the events I would like to process with Fluentd are under 'Forwarded Events' channel,
Is there any chance you could add this channel to the plugin?
Thanks,
BR,

Security Channel log -- ErrorCode: 14

One of our clients encountered this error. (Sorry that i can't reproduce it in my side.) The client has increased the memory from 8GB to 16 GB and now 32GB. But still it got errorCode:14 which is Out of Memory error code in Windows. Also It affects only Security channel. All other channels' logs flow in without trouble.. I looked through the code and this is the stack-trace that i think it might be happening during the crash(only security channel crashed). I wonder how could one single eventlog entry consumed that much memory considering the client has increased it from 8->16->32GB but still sees the error. Alongside there was always a memory spike when the crash happened

(Note: ordering is in invoking sequence)

Error Message:

  2020-12-04 11:07:25 -0800 [warn]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.6.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:322:in `each'
  2020-12-04 11:07:25 -0800 [warn]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.6.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:322:in `on_notify_hash'
  2020-12-04 11:07:25 -0800 [warn]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.6.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:249:in `block (2 levels) in subscribe_channels'
  2020-12-04 11:07:25 -0800 [warn]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.6.0/gems/fluentd-1.11.2-x86-mingw32/lib/fluent/plugin_helper/timer.rb:80:in `on_timer'
  2020-12-04 11:07:25 -0800 [warn]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.6.0/gems/cool.io-1.7.0/lib/cool.io/loop.rb:88:in `run_once'
  2020-12-04 11:07:25 -0800 [warn]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.6.0/gems/cool.io-1.7.0/lib/cool.io/loop.rb:88:in `run'
  2020-12-04 11:07:25 -0800 [warn]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.6.0/gems/fluentd-1.11.2-x86-mingw32/lib/fluent/plugin_helper/event_loop.rb:93:in `block in start'
  2020-12-04 11:07:25 -0800 [warn]: #0 C:/Program Files (x86)/Stackdriver/LoggingAgent/Main/lib/ruby/gems/2.6.0/gems/fluentd-1.11.2-x86-mingw32/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'

Feature Request: Parse Applications and Service Logs

We Run Sysmon on our servers and we would like to parse the Applications and Service Logs\Microsoft\Windows\Sysmon\Operational Log

The Log format is below. Hope you can help. Some info has been obscured for security purposes.

Network connection detected:
UtcTime: 2018-01-15 20:21:12.958
ProcessGuid: {2d8e38d1-5fa9-5a4d-0000-001022780800}
ProcessId: 11556
Image: D:\Program Files (x86)\Websense\Web Security\bin\BrokerService.exe
User: NT AUTHORITY\SYSTEM
Protocol: tcp
Initiated: false
SourceIsIpv6: false
SourceIp: X.X.X.X
SourceHostname: sytemname1.example.com
SourcePort: 55880
SourcePortName:
DestinationIsIpv6: false
DestinationIp: X.X.X.X
DestinationHostname: sytemname2.example.com
DestinationPort: 48792
DestinationPortName:

failed to read data from plugin storage file

Hello,

We are being facing a periodical issue with storage file:

2019-02-01 05:32:25 +0000 [error]: [windows_eventlog] failed to read data from plugin storage file path="./tmp/storage.json" error_class=Yajl::ParseError error="lexical error: invalid char in json text.\n                                                            (right here) ------^\n"
2019-02-01 05:32:25 +0000 [error]: config error file="C:/opt/td-agent/etc/td-agent/td-agent.conf" error_class=Fluent::ConfigError error="Unexpected error: failed to read data from plugin storage file: './tmp/storage.json'"

As workaround temp storage is removed and fluent is restarted then.

Config:

<source>
  @type windows_eventlog
  @id windows_eventlog
  channels application,system
  tag sys.raw
  read_interval 2
  <storage>
    @type local # @type local is the default.
    persistent true # default is true. Set to false to use in-memory storage.
    path ./tmp/storage.json # This is required when persistent is true.
    # Or, please consider using <system> section's `root_dir` parameter.
  </storage>
</source>

Is there any ideas?
System: Windows Core 2016

Feature Request: Set log language/locale

I'm using in_windows_eventlog2 to forward logs from ActiveDirectory to a centralized server.
I also set parse_description to true.
My windows language is set to pt-br but I would like to get the description in English instead of the default language form the OS.
Is that possible somehow?

We are receiving - SystemCallError error="The interface is unknown. - OpenEventLog inside Windows Container

Hi,

Our block of configuration is triggering an error message that we cannot overcome. Can you please advise what is going wrong? We get the same with the version 2 of the plugin.

We are running fluentd on Windows as a container (AWS EKS Windows nodeS).

Regards,
Dejan

__

Error message when invoking the fluentd config for windows_eventlogor windows_eventlog2:

2020-11-30 08:03:36 +0000 [info]: starting fluentd-1.11.5 pid=6996 ruby="2.6.5"
2020-11-30 08:03:36 +0000 [info]: spawn command to main:  cmdline=["C:/ruby26/bin/ruby.exe", "-Eascii-8bit:ascii-8bit", "C:/ruby26/bin/fluentd", "-c", "C:\\fluent\\conf\\fluent.conf", "--under-supervisor"]
2020-11-30 08:03:46 +0000 [info]: adding match pattern="@FLUENT_LOG" type="null"
2020-11-30 08:03:47 +0000 [info]: adding filter pattern="@FLUENT_LOG" type="record_transformer"
2020-11-30 08:03:47 +0000 [info]: adding match pattern="@FLUENT_LOG" type="elasticsearch_dynamic"
2020-11-30 08:03:49 +0000 [info]: adding source type="windows_eventlog"
2020-11-30 08:03:49 +0000 [warn]: #0 in_windows_eventlog is deprecated. It will be removed in the future version.
2020-11-30 08:03:49 +0000 [info]: #0 starting fluentd worker pid=1632 ppid=6996 worker=0
2020-11-30 08:03:49 +0000 [error]: #0 unexpected error error_class=SystemCallError error="The interface is unknown. - OpenEventLog"
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/win32-eventlog-0.6.7/lib/win32/eventlog.rb:112:in `initialize'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog.rb:113:in `new'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog.rb:113:in `block in start'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog.rb:110:in `each'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog.rb:110:in `start'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/root_agent.rb:200:in `block in start'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/root_agent.rb:189:in `block (2 levels) in lifecycle'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/root_agent.rb:188:in `each'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/root_agent.rb:188:in `block in lifecycle'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/root_agent.rb:175:in `each'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/root_agent.rb:175:in `lifecycle'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/root_agent.rb:199:in `start'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/engine.rb:248:in `start'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/engine.rb:147:in `run'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/supervisor.rb:607:in `block in run_worker'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/supervisor.rb:845:in `main_process'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/supervisor.rb:598:in `run_worker'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/lib/fluent/command/fluentd.rb:361:in `<top (required)>'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/lib/ruby/gems/2.6.0/gems/fluentd-1.11.5-x64-mingw32/bin/fluentd:8:in `<top (required)>'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/bin/fluentd:23:in `load'
  2020-11-30 08:03:49 +0000 [error]: #0 C:/ruby26/bin/fluentd:23:in `<main>'
2020-11-30 08:03:49 +0000 [error]: #0 unexpected error error_class=SystemCallError error="The interface is unknown. - OpenEventLog"
  2020-11-30 08:03:49 +0000 [error]: #0 suppressed same stacktrace
2020-11-30 08:03:49 +0000 [info]: Worker 0 finished unexpectedly with status 1

Here is our fluentd config:

   <match @FLUENT_LOG>
      @type null
    </match>
    <source>
      @type windows_eventlog
      channels application,system
      read_interval 2
      tag winevt.raw
      <storage>
        @type local                   # @type local is the default.
        persistent true               # default is true. Set to false to use in-memory storage.
        path /var/log/fluentd-buffers # This is required when persistent is true.
                                      # Or, please consider using <system> section's `root_dir` parameter.
      </storage>
    </source>
    <filter @FLUENT_LOG>
      @type record_transformer
      @id filter_containers_stream_transformer
      <record>
        stream_name ${tag_parts[4]}
      </record>
    </filter>

Add names of attributes to parsed EventData

Hi.
When parse_description is false, eventdata will be added to message, but only values.
Example:
"EventData":["2478079","2023-02-03","200","Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/109.0.0.0+Safari/537.36+Edg/109.0.1518.78"]}
But in xml:
<EventData>
<Data Name="EnabledFieldsFlags">2478079</Data>
<Data Name="date">2023-02-07</Data>
<Data Name="sc-status">200</Data>
<Data Name="csUser-Agent">Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/109.0.0.0+Safari/537.36</Data>
</EventData>
Is it possible to add name of attributes to parsed EventData?
"EventData":["EnabledFieldsFlags":"2478079","date":"2023-02-03","sc-status":"200","csUser-Agent":"Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/109.0.0.0+Safari/537.36+Edg/109.0.1518.78"]}

Logs are not coming for Windows security channel with in_windows_eventlog (old plugin)

Hi Team,

I'm trying to read all channels using td-agent in windows environment. I can see all application,system and windows powershell logs but security channel information is not getting. I'm running fluentd as admin privileges. No issues in logs also .
I can see security event file storage is 2GB. Is any issues with large file?

environment :windows
software :- td-agent-3.3.0-1-x64.msi

read_from_head does not work

I have been trying to set this up on Windows 2016. when this is set, the agent starts and it doesn't send the logs, but it also doesn't 'stamp' the pos file with its log positions. when the agent is restarted it then sends all of the logs from the the start

Any ideas why this is?

Add support to sysmon delimiters?

Parse_description, does not parse sysmon description::key. Cause the delimiter over there is specified by /r/n

Is it possible to have a support for sysmon, to parse_description?

Channel Name Escaping Rules - What are they? (windows-eventlog2)

What is the correct way to name eventlog channels in your source configuration in_windows_eventlog2?

The documentation seems to suggest that it is only possible to source from the core channels: {'application', 'system', 'setup', 'security'}. But there is also a reference to 'HardwareEvents', and indeed this passes configuration/launch. But one can't then use 'WindowsPowerShell' - this configuration is rejected as an invalid channel.

The read_all_channels option seems to do what is says on the tin, and correctly harvests 'complicated' channel names, e.g: Microsoft-Windows-Diagnosis-PCW/Operational. However, it is not then possible to use this same channel name when configuring.

Perhaps I am missing something in terms of the escaping rules for channel name definition?

security logs stop flowing

Our Windows DCs create many security events. fluentd initially sends messages, then after some time it stops, and does not restart unless we restart the process. I added some extra logging to the eventlog plugin so I could tell what is going on.

I make a log entry every time on_notify is called with type "security". Then I log the oldest and total number of events, and finally, if the value passed to receive_lines, is empty or not. For example:

2019-02-26 17:06:40 +0000 [info]: #0 enter on_notify security
2019-02-26 17:06:40 +0000 [info]: #0 oldest: 603639804 total: 5654155
2019-02-26 17:06:51 +0000 [info]: #0 enter receive_lines: false
2019-02-26 17:06:56 +0000 [info]: #0 enter on_notify security
2019-02-26 17:06:56 +0000 [info]: #0 oldest: 603644434 total: 5654129
2019-02-26 17:07:04 +0000 [info]: #0 enter receive_lines: false
2019-02-26 17:07:07 +0000 [info]: #0 enter on_notify security
2019-02-26 17:07:07 +0000 [info]: #0 oldest: 603646452 total: 5654188
2019-02-26 17:07:54 +0000 [info]: #0 enter receive_lines: false
2019-02-26 17:08:28 +0000 [info]: #0 enter on_notify security
2019-02-26 17:08:28 +0000 [info]: #0 oldest: 603679666 total: 5654682

It goes along just fine, then mysteriously stops. What is really confusing is that only the security logs stop flowing, the rest of the log types continue to flow. Nothing is logged to the log file to help either.

Restarting fluentd always fixes the problem.

I'm not sure what to look at next, any ideas or help would be greatly appreciated.

Issue with remote event subscription

Hi,

I'm trying to write a config that queries a remote server for Windows Events. My config looks like this:

<source>
  @type windows_eventlog2
  @id windows_remote
  @log_level trace
  read_existing_events false
  read_interval 2
  tag winevt.remote
  rate_limit 200

  <storage>
    @type local
    persistent true
    path C:\opt\td-agent\winevt-remote.pos
  </storage>

 <subscribe>
   channels ["System"]
   read_existing_events false
   read_all_channels true
   remote_server web-01.<redacted>
   remote_domain <redacted>
   remote_username Administrator
   remote_password <redacted>
 </subscribe>
</source>

<match winevt.remote>
  @type stdout
</match>

And it seems as if no remote events are ever fetched. Instead, it seems to be getting local events for some reason, as per the following output from running this locally (the dc is the local machine running this in my testing environment):

2020-11-09 18:04:47 +0000 [info]: fluent/log.rb:327:info: starting fluentd-1.11.2 pid=5592 ruby="2.7.1"
2020-11-09 18:04:47 +0000 [info]: fluent/log.rb:327:info: spawn command to main:  cmdline=["C:/opt/td-agent/bin/ruby.exe", "-Eascii-8bit:ascii-8bit", "C:/opt/td-agent/bin/fluentd", "-c", "etc\\td-agent\\td-agent.conf", "-v", "--under-supervisor"]
2020-11-09 18:04:55 +0000 [info]: fluent/log.rb:327:info: adding match pattern="winevt.remote" type="stdout"
2020-11-09 18:04:55 +0000 [info]: fluent/log.rb:327:info: adding source type="windows_eventlog2"
2020-11-09 18:04:57 +0000 [debug]: #0 fluent/log.rb:306:debug: No fluent logger for internal event
2020-11-09 18:04:57 +0000 [warn]: fluent/log.rb:348:warn: parameter 'remote_server' in <subscribe>
  channels ["System"]
  read_existing_events false
  remote_server web-01.<redacted>
  remote_domain <redacted>
  remote_username Administrator
  remote_password <redacted>
</subscribe> is not used.
2020-11-09 18:04:57 +0000 [warn]: fluent/log.rb:348:warn: parameter 'remote_domain' in <subscribe>
  channels ["System"]
  read_existing_events false
  remote_server web-01.<redacted>
  remote_domain <redacted>
  remote_username Administrator
  remote_password <redacted>
</subscribe> is not used.
2020-11-09 18:04:57 +0000 [warn]: fluent/log.rb:348:warn: parameter 'remote_username' in <subscribe>
  channels ["System"]
  read_existing_events false
  remote_server web-01.<redacted>
  remote_domain <redacted>
  remote_username Administrator
  remote_password <redacted>
</subscribe> is not used.
2020-11-09 18:04:57 +0000 [warn]: fluent/log.rb:348:warn: parameter 'remote_password' in <subscribe>
  channels ["System"]
  read_existing_events false
  remote_server web-01.<redacted>
  remote_domain <redacted>
  remote_username Administrator
  remote_password <redacted>
</subscribe> is not used.
2020-11-09 18:04:57 +0000 [info]: #0 fluent/log.rb:327:info: starting fluentd worker pid=6612 ppid=5592 worker=0
2020-11-09 18:04:57 +0000 [info]: #0 fluent/log.rb:327:info: fluentd worker is now running worker=0
2020-11-09 18:05:09.089322800 +0000 winevt.remote: {"ProviderName":"Service Control Manager","ProviderGUID":"","EventID":"1073748860","Level":"4","Task":"0","Opcode":"0","Keywords":"0x8080000000000000","TimeCreated":"2020/11/09 18:05:06.614689300","EventRecordID":"65701","ActivityID":"","RelatedActivityID":"","ProcessID":"600","ThreadID":"7648","Channel":"System","Computer":"DC.<redacted>","UserID":"","Version":"0","Description":"The Print Spooler service entered the stopped state.","EventData":["Print Spooler","stopped","?"]}
2020-11-09 18:05:09.094874500 +0000 winevt.remote: {"ProviderName":"Service Control Manager","ProviderGUID":"","EventID":"1073748860","Level":"4","Task":"0","Opcode":"0","Keywords":"0x8080000000000000","TimeCreated":"2020/11/09 18:05:07.937694400","EventRecordID":"65702","ActivityID":"","RelatedActivityID":"","ProcessID":"600","ThreadID":"7648","Channel":"System","Computer":"DC.<redacted>","UserID":"","Version":"0","Description":"The Print Spooler service entered the running state.","EventData":["Print Spooler","running","?"]}

Any advice as to how to proceed in troubleshooting this? I am not sure what those "parameter is not used" - maybe I have misconfigured something?

fluentd windows_log crash "undefined method `chop!' for nil:NilClass"

Describe the bug
When using im using parse_description true the bug occurs after a while, then it will occurs everytime I load the same storage path file. When putting parse_description false everything works fine, but I really need that parse_description to be true.

Running the same config on another computer works fine.

Environment

  • Fluentd 1.7.4
  • Operating system: Windows Server 2019 17763

Configuration

<source>
	@type				windows_eventlog2
	@id				windows_eventlog2
	channels			security
	read_interval		        2
	tag				winevt.raw
	render_as_xml		        true
	rate_limit			200
	parse_description	        true
	
	<storage>
		@type			local
		persistent		true
		path			c:/opt/tmp/storage.json
	</storage>	
	<parse>
		@type			winevt_xml
	</parse>
</source>

Error Log

2020-01-22 13:31:03 +0100 [error]: #0 [windows_eventlog2] Unexpected error raised. Stopping the timer. title=:in_windows_eventlog_security error_class=NoMethodError error="undefined method `chop!' for nil:NilClass"
2020-01-22 13:31:03.294861000 +0100 fluent.error: {"title":"in_windows_eventlog_security","error":"#<NoMethodError: undefined method `chop!' for nil:NilClass>","message":"[windows_eventlog2] Unexpected error raised. Stopping the timer. title=:in_windows_eventlog_security error_class=NoMethodError error=\"undefined method `chop!' for nil:NilClass\""}
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:212:in `block (2 levels) in parse_desc'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:206:in `each'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:206:in `block in parse_desc'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:204:in `each'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:204:in `parse_desc'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:142:in `block (2 levels) in on_notify_xml'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-parser-winevt_xml-0.2.0/lib/fluent/plugin/parser_winevt_xml.rb:35:in `parse'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:123:in `block in on_notify_xml'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:122:in `each'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:122:in `on_notify_xml'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.4.3/lib/fluent/plugin/in_windows_eventlog2.rb:106:in `block (2 levels) in start'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.4/lib/fluent/plugin_helper/timer.rb:80:in `on_timer'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/cool.io-1.5.4/lib/cool.io/loop.rb:88:in `run_once'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/cool.io-1.5.4/lib/cool.io/loop.rb:88:in `run'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.4/lib/fluent/plugin_helper/event_loop.rb:93:in `block in start'
  2020-01-22 13:31:03 +0100 [error]: #0 C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.4/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
2020-01-22 13:31:03 +0100 [error]: #0 [windows_eventlog2] Timer detached. title=:in_windows_eventlog_security
2020-01-22 13:31:03.310476000 +0100 fluent.error: {"title":"in_windows_eventlog_security","message":"[windows_eventlog2] Timer detached. title=:in_windows_eventlog_security"}

Additional context

Support Windows container FluentD querying Windows event logs

Is your feature request related to a problem? Please describe.

FluentD can run within a container on Windows. But when running in this mode, this plugin cannot get the underlying VM's Windows event logs.

Describe the solution you'd like

Allow this plugin to capture Windows event logs when running inside a Windows container. Remote event log access, WMI Remoting, Powershell remoting, CIM sessions, etc. could be used for establishing this connection.

Describe alternatives you've considered

There is no way of running this plugin to get underlying VM's event logs from within a container. Only option is to run as a service on Windows outside of a container.

Feature request: more keys or dynamic keys

Hello,

The v0.14 fluentd MSI is great, much easier than the approach on v0.12, many thanks!

We've been comparing winlogbeat to fluent-plugin-windows-eventlog. One big disadvantage to fluentd is the small key/field list. Our particular use case involves the information in the event_data element for security events.

For now, I guess we're stuck with winlogbeat, but I might be able to contribute a PR in the future. Maybe a more dynamic XML to JSON approach would be feasible such that keys/fields are dynamically generated?

High Memory Usage

Hello,

I've been playing around trying to get this plugin running on Windows Server 2012 R2 (as well as one server of 2008). So far, I keep running into the issue of Fluentd eating up pretty much all available memory. I've used it on VMs with 4gb and 8gb of ram. It just eats up whatever is available.

I've tried this with a bunch of different configs, all of them pretty simple. I've messed around with pretty much every option available. It seems to be inconsistent when this happens and I've had a couple instances where it has run without issue.

One of the many configs I've tried (I've also done a version where I output the data to a file).

<source>
	@type windows_eventlog
	@id windows_eventlog
	channels application,system,security
	tag winevt.raw
	<storage>
		@type local
		persistent true
		path C:\opt\td-agent\winevt.pos
	</storage>
  
</source>

<match **>
	@type stdout
</match>

Oddly, when I run read_from_head true it uses pretty limited resources until it finishes collecting the past logs. Once it catches up and is back to only processing inputs as they come in, it spikes again.

The main consistency I've found, is that when I shut down the agent when it's consuming 3-4GB of ram, it gives these warnings when it shuts down. It does not give these warnings when it is running smoothly.

`2019-05-17 17:38:44 -0500 [info]: #0 shutting down fluentd worker worker=0
2019-05-17 17:38:44 -0500 [info]: #0 shutting down input plugin type=:windows_ev
entlog plugin_id="object:1c677fc"
2019-05-17 17:38:44 -0500 [info]: #0 shutting down output plugin type=:file plug
in_id="object:1c21c48"
2019-05-17 17:38:56 -0500 [warn]: #0 event loop does NOT exit until hard timeout
.
2019-05-17 17:38:57 -0500 [warn]: #0 killing existing thread thread=#<Thread:0x0
000000003891b08@C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.4.2/
lib/fluent/plugin_helper/thread.rb:70 run>
2019-05-17 17:38:57 -0500 [warn]: #0 thread doesn't exit correctly (killed or ot
her reason) plugin=Fluent::Plugin::WindowsEventLogInput title=:event_loop thread
=#<Thread:0x0000000003891b08@C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/f
luentd-1.4.2/lib/fluent/plugin_helper/thread.rb:70 aborting> error=nil`

Any ideas? Trying to cut down on agent bloat and bundling a coupe things into fluentd would help a lot.

Can't remotely get any events emitted from host side windows in fluentd on windows container

I'm trying to get Windows Event Log on native windows machine from fluentd running as windows container on the same machine. As long as looking at log of fluentd, it seems fluentd successfully connected to remote box(host machine) although, fluentd doesn't detect any windows events of remote box. I can get windows event log of guest machine, so I think fluentd is working correctly yet. I'm wondering if you could provide any advices for this issue?

Environment

  • Host: Windows 10 21H1
  • Guest: fluent/fluentd:v1.13-windows-ltsc2019-1
  • fluent-plugin-windows-eventlog-0.8.0

Steps to recreate this issue

# In Powershell (Run as admin)
PS > netsh advfirewall firewall set rule group="Remote Event Log Management" new enable=yes

# In Powershell
PS > docker run -d --name test `
-v C:\some\where\tmp:c:\fluent\conf `
--entrypoint cmd `
-t fluent/fluentd:v1.13-windows-ltsc2019-1
PS > docker exec -it test powershell

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\> gem install fluent-plugin-windows-eventlog
Fetching fluent-plugin-windows-eventlog-0.8.0.gem
Fetching win32-eventlog-0.6.7.gem
Fetching winevt_c-0.9.3.gem
Successfully installed win32-eventlog-0.6.7
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed winevt_c-0.9.3
Successfully installed fluent-plugin-windows-eventlog-0.8.0
3 gems installed
PS C:\>
PS C:\> gem install nokogiri
Fetching nokogiri-1.11.7-x64-mingw32.gem
Fetching racc-1.5.2.gem
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed racc-1.5.2
Successfully installed nokogiri-1.11.7-x64-mingw32
2 gems installed
PS C:\>
PS C:\> gem install fluent-plugin-parser-winevt_xml
Fetching fluent-plugin-parser-winevt_xml-0.2.2.gem
Successfully installed fluent-plugin-parser-winevt_xml-0.2.2
1 gem installed
PS C:\>
PS C:\> whoami
user manager\containeradministrator
PS C:\> Add-LocalGroupMember -Group "Event Log Readers" -Member "user manager\container
administrator"
PS C:\>
PS C:\> ipconfig

Windows IP Configuration


Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::5181:182c:a96c:64a3%4
   IPv4 Address. . . . . . . . . . . : 172.20.34.25
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . : 172.20.32.1
PS C:\>
PS C:\> hostname
17ab2839905e
PS C:\>
PS C:\>fluentd -c C:\fluent\conf\fluent.conf -v

And I tested by emitting the following dummy event manually.

eventcreate /ID 999 /L Application /SO DummySource /T Information /D "This is a test message."

Log

PS C:\> fluentd -c C:\fluent\conf\fluent.conf -v
2021-07-06 23:50:22 +0900 [info]: fluent/log.rb:330:info: parsing config file is succeeded path="C:\\fluent\\conf\\fluent.conf"
2021-07-06 23:50:22 +0900 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-parser-winevt_xml' version '0.2.2'
2021-07-06 23:50:22 +0900 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-windows-eventlog' version '0.8.0'
2021-07-06 23:50:22 +0900 [info]: fluent/log.rb:330:info: gem 'fluentd' version '1.13.1'
2021-07-06 23:50:23 +0900 [debug]: [windows_eventlog2] connect to remote box (server: 172.20.32.1) domain: DESKTOP-D9O1OE9.WORKGROUP username: nekia)
2021-07-06 23:50:23 +0900 [warn]: fluent/log.rb:351:warn: define <match fluent.**> to capture fluentd logs in top level is deprecated. Use <label @FLUENT_LOG> instead
2021-07-06 23:50:23 +0900 [info]: fluent/log.rb:330:info: using configuration file: <ROOT>
  <source>
    @type windows_eventlog2
    @id windows_eventlog2
    read_interval 2
    tag "winevt.raw"
    <storage>
      @type "local"
      persistent true
      path "./tmp/storage.json"
    </storage>
    <subscribe>
      channels Application
      read_existing_events false
      remote_server "172.20.32.1"
      remote_domain "DESKTOP-D9O1OE9.WORKGROUP"
      remote_username "nekia"
      remote_password xxxxxx
    </subscribe>
  </source>
  <match **>
    @type stdout
  </match>
</ROOT>
2021-07-06 23:50:23 +0900 [info]: fluent/log.rb:330:info: starting fluentd-1.13.1 pid=1880 ruby="2.6.5"
2021-07-06 23:50:23 +0900 [info]: fluent/log.rb:330:info: spawn command to main:  cmdline=["C:/ruby26/bin/ruby.exe", "-Eascii-8bit:ascii-8bit", "C:/ruby26/bin/fluentd", "-c", "C:\\fluent\\conf\\fluent.conf", "-v", "--under-supervisor"]
2021-07-06 23:50:26 +0900 [info]: fluent/log.rb:330:info: adding match pattern="**" type="stdout"
2021-07-06 23:50:26 +0900 [info]: fluent/log.rb:330:info: adding source type="windows_eventlog2"
2021-07-06 23:50:27 +0900 [debug]: #0 [windows_eventlog2] connect to remote box (server: 172.20.32.1) domain: DESKTOP-D9O1OE9.WORKGROUP username: nekia)
2021-07-06 23:50:27 +0900 [warn]: #0 fluent/log.rb:351:warn: define <match fluent.**> to capture fluentd logs in top level is deprecated. Use <label @FLUENT_LOG> instead
2021-07-06 23:50:27 +0900 [info]: #0 fluent/log.rb:330:info: starting fluentd worker pid=1688 ppid=1880 worker=0
2021-07-06 23:50:27 +0900 [warn]: #0 [windows_eventlog2] This stored bookmark is incomplete for using. Referring `read_existing_events` parameter to subscribe: <BookmarkListDirection='backward'>
</BookmarkList>, channel: application
2021-07-06 23:50:27 +0900 [debug]: #0 [windows_eventlog2] channel (application) subscription is subscribed.
2021-07-06 23:50:27 +0900 [info]: #0 fluent/log.rb:330:info: fluentd worker is now running worker=0
2021-07-06 23:50:27.415647100 +0900 fluent.info: {"pid":1688,"ppid":1880,"worker":0,"message":"starting fluentd worker pid=1688 ppid=1880 worker=0"}
2021-07-06 23:50:27.419596600 +0900 fluent.warn: {"message":"[windows_eventlog2] This stored bookmark is incomplete for using. Referring `read_existing_events` parameter to subscribe: <BookmarkList Direction='backward'>\r\n</BookmarkList>, channel: application"}
2021-07-06 23:50:27.422463200 +0900 fluent.debug: {"message":"[windows_eventlog2] channel (application) subscription is subscribed."}
2021-07-06 23:50:27.424122500 +0900 fluent.info: {"worker":0,"message":"fluentd workeris now running worker=0"}
2021-07-06 23:56:49.456301000 +0900 winevt.raw: {"ProviderName":"DummySource","Provider
GUID":"","EventID":"999","Level":"4","Task":"0","Opcode":"0","Keywords":"0x800000000000
00","TimeCreated":"2021/07/06 14:56:49.120846000","EventRecordID":"56","ActivityID":"",
"RelatedActivityID":"","ProcessID":"0","ThreadID":"0","Channel":"Application","Computer
":"17ab2839905e","UserID":"S-1-5-93-2-1","Version":"0","Description":"This is a test me
ssage.","EventData":["This is a test message."]}

The event detected at the end of above log is the one coming from guest machine ({"Computer":"17ab2839905e"}).

Configuration

<source>
  @type windows_eventlog2
  @id windows_eventlog2
  read_interval 2
  tag winevt.raw
  <storage>
    @type local             # @type local is the default.
    persistent true         # default is true. Set to false to use in-memory storage.
    path ./tmp/storage.json # This is required when persistent is true. If migrating from eventlog v1 please ensure that you remove the old .pos folder
  </storage>
  <subscribe>
    channels Application
    read_existing_events false # read_existing_events should be applied each of subscribe directive(s)
    remote_server 172.20.32.1 # Remote server ip/fqdn
    remote_domain DESKTOP-D9O1OE9.WORKGROUP # Domain name
    remote_username nekia # Remoting access account name
    remote_password ****** # Remoting access account password
  </subscribe>
</source>
<match **>
  @type stdout
</match>

Feature Request: Subscribe to all log channels

Wouldnt it be possible to get all the channels with this function
"Gets a handle that you use to enumerate the list of channels that are registered on the computer."

Currently im using a powershell script to get all the channels but would be easier if it was built into the plugin.

Library names injected if message not found in the message table

Note sure where is it coming from, but i see the library names only when the event log has no proper description.
I am using the eventlog2 plugin.

"DescriptionTitle": "The message resource is present but the message was not found in the message table.\r\n0.4.6/fluent/plugin/parser_winevt_xml.so"
"DescriptionTitle": "The message resource is present but the message was not found in the message table.\r\nib/fluent/plugin/in_windows_eventlog2.rb",
"EventData": [
  "C:\\ProgramData\\Datadog\\datadog.yaml seems to contain a valid configuration, not overwriting config"
],

Error when initiating fluentd daemon with plugin

Describe the bug

When I start the program, it automatically exits the application.

Enviroment

OS
Windows 10 PRO 19043.1348

Ruby
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x64-mingw32]

GEM

addressable (2.8.0)
async (1.30.0)
async-http (0.56.3)
async-io (1.32.2)
async-pool (0.3.8)
aws-eventstream (1.1.1)
aws-partitions (1.478.0)
aws-sdk-core (3.117.0)
aws-sdk-kms (1.44.0)
aws-sdk-s3 (1.96.1)
aws-sdk-sqs (1.40.0)
aws-sigv4 (1.2.4)
benchmark (default: 0.1.0)
bigdecimal (default: 2.0.0)
bundler (2.2.23, default: 2.1.4)
certstore_c (0.1.7)
cgi (default: 0.1.0)
concurrent-ruby (1.1.9)
console (1.13.1)
cool.io (1.7.1 x64-mingw32)
csv (default: 3.1.2)
date (default: 3.0.0)
dbm (default: 1.1.0)
delegate (default: 0.1.0)
did_you_mean (default: 1.4.0)
digest-crc (0.6.4)
elasticsearch (7.13.3)
elasticsearch-api (7.13.3)
elasticsearch-transport (7.13.3)
etc (default: 1.1.0)
excon (0.85.0)
faraday (1.5.1)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
fcntl (default: 1.0.0)
ffi (1.15.3 x64-mingw32)
ffi-win32-extensions (1.0.4)
fiber-local (1.0.0)
fiddle (default: 1.0.0)
fileutils (1.5.0, default: 1.4.1)
fluent-config-regexp-type (1.0.0)
fluent-diagtool (1.0.1)
fluent-logger (0.9.0)
fluent-plugin-elasticsearch (5.0.5)
fluent-plugin-flowcounter-simple (0.1.0)
fluent-plugin-kafka (0.16.3)
fluent-plugin-parser-winevt_xml (0.2.2)
fluent-plugin-prometheus (2.0.1)
fluent-plugin-prometheus_pushgateway (0.1.0)
fluent-plugin-record-modifier (2.1.0)
fluent-plugin-rewrite-tag-filter (2.4.0)
fluent-plugin-s3 (1.6.0)
fluent-plugin-sd-dns (0.1.0)
fluent-plugin-td (1.1.0)
fluent-plugin-webhdfs (1.4.0)
fluent-plugin-windows-eventlog (0.8.0)
fluentd (1.13.3)
forwardable (default: 1.3.1)
gdbm (default: 2.1.0)
getoptlong (default: 0.1.0)
hirb (0.7.3)
http_parser.rb (0.7.0)
httpclient (2.8.3)
io-console (default: 0.5.6)
ipaddr (default: 1.2.2)
irb (default: 1.2.6)
jmespath (1.4.0)
json (2.5.1, default: 2.3.0)
logger (default: 1.4.2)
ltsv (0.1.2)
matrix (default: 0.2.0)
minitest (5.13.0)
msgpack (1.4.2)
multi_json (1.15.0)
multipart-post (2.1.1)
mutex_m (default: 0.1.0)
net-pop (default: 0.1.0)
net-smtp (default: 0.1.0)
net-telnet (0.2.0)
nio4r (2.5.7)
nokogiri (1.11.7 x64-mingw32)
observer (default: 0.1.0)
oj (3.12.1)
open3 (default: 0.1.0)
openssl (default: 2.1.2)
ostruct (default: 0.2.0)
parallel (1.20.1)
power_assert (1.1.7)
prime (default: 0.1.1)
prometheus-client (2.1.0)
protocol-hpack (1.4.2)
protocol-http (0.22.5)
protocol-http1 (0.14.1)
protocol-http2 (0.14.2)
pstore (default: 0.1.0)
psych (default: 3.1.0)
public_suffix (4.0.6)
racc (1.5.2, default: 1.4.16)
rake (13.0.6, 13.0.1)
rdoc (default: 6.2.1.1)
readline (default: 0.0.2)
reline (default: 0.1.5)
rexml (default: 3.2.3.1)
rss (default: 0.2.8)
ruby-kafka (1.3.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
rubyzip (1.3.0)
sdbm (default: 1.0.0)
serverengine (2.2.4 x64-mingw32)
sigdump (0.2.4)
singleton (default: 0.1.0)
stringio (default: 0.1.0)
strptime (0.2.5)
strscan (default: 1.0.3)
td (0.16.9)
td-client (1.0.8)
td-logger (0.3.27)
test-unit (3.3.4)
timeout (default: 0.1.0)
timers (4.3.3)
tracer (default: 0.1.0)
tzinfo (2.0.4)
tzinfo-data (1.2021.1)
uri (default: 0.10.0)
webhdfs (0.9.0)
webrick (1.7.0, default: 1.6.1)
win32-api (1.10.1 universal-mingw32)
win32-event (0.6.3)
win32-eventlog (0.6.7)
win32-ipc (0.7.0)
win32-service (2.2.0)
windows-api (0.4.4)
windows-pr (1.2.6)
winevt_c (0.9.2)
xmlrpc (0.3.0)
yajl-ruby (1.4.1)
yaml (default: 0.1.0)
zip-zip (0.3)
zlib (default: 1.1.0)

Log

2021-11-19 07:27:43 -0300 [info]: parsing config file is succeeded path="C:\\opt\\td-agent\\etc\\td-agent\\td-agent.conf"
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-elasticsearch' version '5.0.5'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-flowcounter-simple' version '0.1.0'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-kafka' version '0.16.3'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-parser-winevt_xml' version '0.2.2'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-prometheus' version '2.0.1'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-prometheus_pushgateway' version '0.1.0'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-record-modifier' version '2.1.0'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-rewrite-tag-filter' version '2.4.0'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-s3' version '1.6.0'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-sd-dns' version '0.1.0'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-td' version '1.1.0'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-webhdfs' version '1.4.0'
2021-11-19 07:27:43 -0300 [info]: gem 'fluent-plugin-windows-eventlog' version '0.8.0'
2021-11-19 07:27:43 -0300 [info]: gem 'fluentd' version '1.13.3'
2021-11-19 07:27:44 -0300 [info]: using configuration file: <ROOT>
  <system>
    log_level info
  </system>
  <source>
    @type windows_eventlog2
    @id windows_eventlog2
    tag "winevt"
    channels application,system,security,setup
    <storage>
      @type "local"
      persistent true
      path "C:\\opt\\td-agent\\var\\post_file\\windows\\eventlog.pos"
    </storage>
  </source>
  <match winevt>
    @type file
    path "C:\\opt\\td-agent\\var\\log\\windows\\eventlog"
    append true
    <buffer>
      @type "file"
      path "C:\\opt\\td-agent\\var\\buffer\\eventlog"
      flush_mode interval
      flush_interval 5s
    </buffer>
    <format>
      @type "out_file"
    </format>
  </match>
</ROOT>
2021-11-19 07:27:44 -0300 [info]: starting fluentd-1.13.3 pid=8140 ruby="2.7.4"
2021-11-19 07:27:44 -0300 [info]: spawn command to main:  cmdline=["C:/opt/td-agent/bin/ruby.exe", "-Eascii-8bit:ascii-8bit", "C:/opt/td-agent/bin/fluentd", "-c", "C:\\opt\\td-agent\\etc\\td-agent\\td-agent.conf", "-o", "C:\\opt\\td-agent\\td-agent.log", "-x", "fluentdwinsvc", "--under-supervisor"]
2021-11-19 07:27:47 -0300 [info]: adding match pattern="winevt" type="file"
2021-11-19 07:27:47 -0300 [info]: adding source type="windows_eventlog2"
2021-11-19 07:27:48 -0300 [info]: #0 starting fluentd worker pid=6544 ppid=8140 worker=0
2021-11-19 07:27:48 -0300 [error]: #0 unexpected error error_class=TypeError error="no implicit conversion of Array into String"
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/nokogiri-1.11.7-x64-mingw32/lib/nokogiri/xml/sax/parser.rb:109:in `memory'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/nokogiri-1.11.7-x64-mingw32/lib/nokogiri/xml/sax/parser.rb:109:in `parse_memory'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/nokogiri-1.11.7-x64-mingw32/lib/nokogiri/xml/sax/parser.rb:84:in `parse'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:260:in `bookmark_validator'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:227:in `subscription'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:197:in `block (2 levels) in refresh_subscriptions'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:181:in `retry_on_error'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:196:in `block in refresh_subscriptions'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:195:in `each'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:195:in `refresh_subscriptions'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluent-plugin-windows-eventlog-0.8.0/lib/fluent/plugin/in_windows_eventlog2.rb:158:in `start'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/root_agent.rb:200:in `block in start'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/root_agent.rb:189:in `block (2 levels) in lifecycle'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/root_agent.rb:188:in `each'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/root_agent.rb:188:in `block in lifecycle'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/root_agent.rb:175:in `each'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/root_agent.rb:175:in `lifecycle'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/root_agent.rb:199:in `start'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/engine.rb:248:in `start'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/engine.rb:147:in `run'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/supervisor.rb:715:in `block in run_worker'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/supervisor.rb:966:in `main_process'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/supervisor.rb:706:in `run_worker'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/lib/fluent/command/fluentd.rb:364:in `<top (required)>'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/fluentd-1.13.3/bin/fluentd:15:in `<top (required)>'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/bin/fluentd:23:in `load'
  2021-11-19 07:27:48 -0300 [error]: #0 C:/opt/td-agent/bin/fluentd:23:in `<main>'
2021-11-19 07:27:48 -0300 [error]: #0 unexpected error error_class=TypeError error="no implicit conversion of Array into String"
  2021-11-19 07:27:48 -0300 [error]: #0 suppressed same stacktrace
2021-11-19 07:27:48 -0300 [info]: Worker 0 finished unexpectedly with status 1

Error using windows_eventlog2

I followed thread #22 and was able to get to a point where it is finding plugin called windows_eventlog2 but I am getting error wrong argument type Array (expected String). My config (as shown) is pretty simple. Thoughts?

Here is the full output:

C:\Ruby25-x64\bin>fluentd -c C:\opt\td-agent\etc\td-agent\td-agent.conf
2019-08-22 18:12:17 -0600 [info]: parsing config file is succeeded path="C:\\opt\\td-agent\\etc\\td-agent\\td-agent.conf"
2019-08-22 18:12:17 -0600 [info]: using configuration file: <ROOT>
  <source>
    @type windows_eventlog2
    @id windows_eventlog2
    channels cor
    tag "winevt.raw"
    <storage>
      @type "local"
      persistent true
      path "C:\\opt\\td-agent\\winevt.pos"
    </storage>
  </source>
  <match winevt.**>
    @type stdout
  </match>
</ROOT>
2019-08-22 18:12:17 -0600 [info]: starting fluentd-1.7.0 pid=17596 ruby="2.5.5"
2019-08-22 18:12:17 -0600 [info]: spawn command to main:  cmdline=["C:/Ruby25-x64/bin/ruby.exe", "-Eascii-8bit:ascii-8bit", "C:/Ruby25-x64/bin/fluentd", "-c", "C:\\opt\\td-agent\\etc\\td-agent\\td-agent.conf", "--under-supervisor"]
2019-08-22 18:12:19 -0600 [info]: gem 'fluent-plugin-windows-eventlog' version '0.3.0'
2019-08-22 18:12:19 -0600 [info]: gem 'fluentd' version '1.7.0'
2019-08-22 18:12:19 -0600 [info]: adding match pattern="winevt.**" type="stdout"
2019-08-22 18:12:19 -0600 [info]: adding source type="windows_eventlog2"
2019-08-22 18:12:20 -0600 [info]: #0 starting fluentd worker pid=28924 ppid=17596 worker=0
2019-08-22 18:12:20 -0600 [error]: #0 unexpected error error_class=TypeError error="wrong argument type Array (expected String)"
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluent-plugin-windows-eventlog-0.3.0/lib/fluent/plugin/in_windows_eventlog2.rb:77:in `initialize'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluent-plugin-windows-eventlog-0.3.0/lib/fluent/plugin/in_windows_eventlog2.rb:77:in `new'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluent-plugin-windows-eventlog-0.3.0/lib/fluent/plugin/in_windows_eventlog2.rb:77:in `block in start'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluent-plugin-windows-eventlog-0.3.0/lib/fluent/plugin/in_windows_eventlog2.rb:74:in `each'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluent-plugin-windows-eventlog-0.3.0/lib/fluent/plugin/in_windows_eventlog2.rb:74:in `start'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/root_agent.rb:203:in `block in start'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/root_agent.rb:192:in `block (2 levels) in lifecycle'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/root_agent.rb:191:in `each'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/root_agent.rb:191:in `block in lifecycle'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/root_agent.rb:178:in `each'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/root_agent.rb:178:in `lifecycle'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/root_agent.rb:202:in `start'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/engine.rb:274:in `start'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/engine.rb:219:in `run'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/supervisor.rb:808:in `run_engine'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/supervisor.rb:551:in `block in run_worker'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/supervisor.rb:733:in `main_process'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/supervisor.rb:546:in `run_worker'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/lib/fluent/command/fluentd.rb:320:in `<top (required)>'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/fluentd-1.7.0-x64-mingw32/bin/fluentd:8:in `<top (required)>'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/bin/fluentd:23:in `load'
  2019-08-22 18:12:20 -0600 [error]: #0 C:/Ruby25-x64/bin/fluentd:23:in `<main>'
2019-08-22 18:12:20 -0600 [error]: #0 unexpected error error_class=TypeError error="wrong argument type Array (expected String)"
  2019-08-22 18:12:20 -0600 [error]: #0 suppressed same stacktrace
2019-08-22 18:12:20 -0600 [info]: Worker 0 finished unexpectedly with status 1
2019-08-22 18:12:20 -0600 [info]: Received graceful stop
Traceback (most recent call last):
        29: from C:/Ruby25-x64/bin/fluentd:23:in `<main>'
        28: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems.rb:304:in `activate_bin_path'
        27: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems.rb:304:in `synchronize'
        26: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems.rb:306:in `block in activate_bin_path'
        25: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems.rb:243:in `finish_resolve'
        24: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/request_set.rb:397:in `resolve_current'
        23: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/request_set.rb:385:in `resolve'
        22: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver.rb:188:in `resolve'
        21: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/resolver.rb:42:in `resolve'
        20: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:64:in `resolve'
        19: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:106:in `start_resolution'
        18: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:165:in `initial_state'
        17: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:51:in `sort_dependencies'
        16: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:69:in `with_no_such_dependency_error_handling'
        15: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:52:in `block in sort_dependencies'
        14: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver.rb:277:in `sort_dependencies'
        13: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver.rb:277:in `with_index'
        12: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver.rb:277:in `sort_by'
        11: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver.rb:277:in `each'
        10: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver.rb:281:in `block in sort_dependencies'
         9: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver.rb:303:in `amount_constrained'
         8: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/resolver/current_set.rb:10:in `find_all'
         7: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/dependency.rb:279:in `matching_specs'
         6: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/specification.rb:869:in `stubs_for'
         5: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/specification.rb:782:in `installed_stubs'
         4: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/specification.rb:790:in `map_stubs'
         3: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/specification.rb:790:in `flat_map'
         2: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/specification.rb:790:in `each'
         1: from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/specification.rb:793:in `block in map_stubs'
C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/specification.rb:769:in `gemspec_stubs_in': Interrupt
2019-08-22 18:12:21 -0600 [info]: Worker 0 finished with status 3

Log Parameters are changed for new plugin version windows_eventlog2.

Previously when we used plugin windows_eventlog, then we are getting event_type parameter in logs & bases on that we had designed the Loki query & made a Grafana Dashboard.
Now with new plugin windows_eventlog2 , this field is removed & no new parameter is giving this information.
So can i get the information of type of logs(i.e. Error, Warning or Information) for windows in new plugin windows_eventlogs2.
I had also observed that logs in Windows has one parameter called Level which is indicating this details but this field in converted into integer when i see the logs in Loki as per documentation.
Can you suggest any solution here that how can I get the event_type information for new plugin windows_eventlog2?

Fluentd agent completely stuck due to printing "pattern not match warning"

Hi Team,

We observed that when Fluentd agent is overwhelmed with "pattern not matched:" warning after some time it gets stuck and stopped processing. Both tailing and flushing buffers are stuck.

To reproduce this issue we run an experiment with the below configuration

<source>
     @type tail
     tag 6c6561.ashoklinux2heartbeat
     path  /var/log/heartbeat/hosts/*/heartbeat.log
     pos_file  /etc/unifiedmonitoringagent/pos/6c6561-ashoklinux2heartbeat.pos
     path_key  tailed_path
     <parse>
         @type none
         types  {}
         keep_time_key  false
         null_empty_string  false
         estimate_current_event  true
         timeout  0
     </parse>
 </source>

 <match 6c6561.**>
     @type xxx-xxx
     log_object_id  testid
     <buffer tag>
         @type file
         retry_timeout  3h
         path  /opt/unifiedmonitoringagent/run/buffer/6c6561
         disable_chunk_backup  true
         chunk_limit_size  5MB
         flush_interval  60s
         total_limit_size  1GB
         overflow_action  throw_exception
         retry_type  exponential_backoff
     </buffer>
 </match>
 <source>
     @type tail
     tag 687861.patternnotmatch
     path  /var/log/pattern_not_match/pattern_not_match.log
     pos_file  /etc/unifiedmonitoringagent/pos/687861-patternnotmatch.pos
     path_key  tailed_path
     <parse>
         @type none
         types  {}
         keep_time_key  false
         null_empty_string  false
         estimate_current_event  false
         timeout  0
     </parse>
 </source>

 <match 687861.**>
     @type oci_logging
     log_object_id  ocid1.log.oc1.phx.amaaaaaa4p7m3syaoyyu65n7x5l6tgcjd3bls74vhlwl6pumxooizrax3g3q
     <buffer tag>
         @type file
         retry_timeout  3h
         path  /opt/unifiedmonitoringagent/run/buffer/687861
         disable_chunk_backup  true
         chunk_limit_size  5MB
         flush_interval  180s
         total_limit_size  1GB
         overflow_action  throw_exception
         retry_type  exponential_backoff
     </buffer>
 </match>

Case1:
Fluentd agent running fine and able to process incoming logs file heartbeat.log.
Case 2:
In addition to case 1, we started appending logs to file pattern_not_match.log which will result in pattern not match warning and overwhelmed files with new logs. After some time agent got stuck and stopped processing logs from the heartbeat.log file.
we stopped adding log line to pattern_not_match.log but the agent didn't recover from the stuck state.

Case3: manually commented https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/in_tail.rb#L640 to stop printing pattern not match warning, and restarted agent. and repeated case 2. The agent was running fine and pattern not warning not impacting fluentd now.

For each case, the sig dump is attached.

Screenshot 2022-11-07 at 3 50 38 PM

Case 1 : 6:55 AM to 8:10AM
Case 2: 8:10 AM to 9:15AM
case 3 : 9:15 AM to continue

Why print log line with pattern not match warning resulting into this issue? @ashie can you look into this?
https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/in_tail.rb#L640

Sigdump atteched below.
case 1

[root@kashokum-downloader tmp]# ps -ef | grep unified
root      2534     1  0 06:40 ?        00:00:00 /opt/unified-monitoring-agent/embedded/bin/ruby /opt/unified-monitoring-agent/embedded/bin/fluentd --log /var/log/unified-monitoring-agent/unified-monitoring-agent.log --daemon /var/run/unified-monitoring-agent/unified-monitoring-agent.pid --log-rotate-size 1048576 --log-rotate-age 10
root      2537  2534  0 06:40 ?        00:00:02 /opt/unified-monitoring-agent/embedded/bin/ruby -Eascii-8bit:ascii-8bit /opt/unified-monitoring-agent/embedded/bin/fluentd --log /var/log/unified-monitoring-agent/unified-monitoring-agent.log --daemon /var/run/unified-monitoring-agent/unified-monitoring-agent.pid --log-rotate-size 1048576 --log-rotate-age 10 --under-supervisor

sigdump-2534.log

sigdump-2537.log

case 2

[root@kashokum-downloader opt]# ps -ef | grep unified
root     22200     1  0 08:10 ?        00:00:00 /opt/unified-monitoring-agent/embedded/bin/ruby /opt/unified-monitoring-agent/embedded/bin/fluentd --log /var/log/unified-monitoring-agent/unified-monitoring-agent.log --daemon /var/run/unified-monitoring-agent/unified-monitoring-agent.pid --log-rotate-size 1048576 --log-rotate-age 10
root     22203 22200 39 08:10 ?        00:21:00 /opt/unified-monitoring-agent/embedded/bin/ruby -Eascii-8bit:ascii-8bit /opt/unified-monitoring-agent/embedded/bin/fluentd --log /var/log/unified-monitoring-agent/unified-monitoring-agent.log --daemon /var/run/unified-monitoring-agent/unified-monitoring-agent.pid --log-rotate-size 1048576 --log-rotate-age 10 --under-supervisor

sigdump-22200.log
sigdump-22203.log

case 3

[root@kashokum-downloader tmp]# ps -ef | grep unified
root      3975     1  0 09:15 ?        00:00:00 /opt/unified-monitoring-agent/embedded/bin/ruby /opt/unified-monitoring-agent/embedded/bin/fluentd --log /var/log/unified-monitoring-agent/unified-monitoring-agent.log --daemon /var/run/unified-monitoring-agent/unified-monitoring-agent.pid --log-rotate-size 1048576 --log-rotate-age 10
root      3978  3975  8 09:15 ?        00:05:46 /opt/unified-monitoring-agent/embedded/bin/ruby -Eascii-8bit:ascii-8bit /opt/unified-monitoring-agent/embedded/bin/fluentd --log /var/log/unified-monitoring-agent/unified-monitoring-agent.log --daemon /var/run/unified-monitoring-agent/unified-monitoring-agent.pid --log-rotate-size 1048576 --log-rotate-age 10 --under-supervisor

sigdump-3975.log
sigdump-3978.log

Support evtx log files without workaround

Currently only items listed under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog are accessible to this plugin. This is due to the underlying win32-eventlog gem only providing access to the listed logs.

Bellow are a list of them on Sever 2016

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\HardwareEvents
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Internet Explorer
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Key Management Service
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\System
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Windows PowerShell

WARNING: if the channel can't be found in this registry location by the underlying Win32 call it just returns Application

I have been trying to monitor IIS logs at Microsoft-IIS-Logging/Logs but since they are in the new evtx format, they are not found by default.

There is a work around.

You can add the facade to access any evtx file via adding a registry key.

$LogName = 'Microsoft-IIS-Logging/Logs'
$LogPath = $(Get-WinEvent -ListLog $LogName).LogFilePath
$RegPath = "HKLM\SYSTEM\CurrentControlSet\Services\EventLog\${LogName}"
REG ADD $RegPath /v 'File' /d $LogPath /t REG_EXPAND_SZ

NOTE: The reason we can't use New-Item is because the forward slash gets escaped.

unable to install fluent-plugin-windows-eventlog 0.3.0

I'm unable to install the newest version. the following is the error message i'm getting
current directory: C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/winevt_c-0.5.1/ext/winevt
C:/opt/td-agent/embedded/bin/ruby.exe -r ./siteconf20190713-6184-a4vsfm.rb extconf.rb
checking for -lwevtapi... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/opt/td-agent/embedded/bin/$(RUBY_BASE_NAME)
--with-winevt-dir
--without-winevt-dir
--with-winevt-include
--without-winevt-include=${winevt-dir}/include
--with-winevt-lib
--without-winevt-lib=${winevt-dir}/lib
--with-wevtapilib
--without-wevtapilib
C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:468:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:553:in try_link0'
from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:568:in try_link' from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:787:in try_func'
from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:1014:in block in have_library' from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:957:in block in checking_for'
from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:351:in block (2 levels) in postpone' from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:321:in open'
from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:351:in block in postpone' from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:321:in open'
from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:347:in postpone' from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:956:in checking_for'
from C:/opt/td-agent/embedded/lib/ruby/2.4.0/mkmf.rb:1009:in have_library' from extconf.rb:13:in

'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/winevt_c-0.5.1/mkmf.log

extconf failed, exit code 1


Here is the content from C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/winevt_c-0.5.1/mkmf.log

"gcc -o conftest.exe -IC:/opt/td-agent/embedded/include/ruby-2.4.0/x64-mingw32 -IC:/opt/td-agent/embedded/include/ruby-2.4.0/ruby/backward -IC:/opt/td-agent/embedded/include/ruby-2.4.0 -I. -IC:/opt/td-agent/embedded/include -DFD_SETSIZE=2048 -m64 -march=x86-64 -O2 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -IC:/opt/td-agent/embedded/include -DFD_SETSIZE=2048 -march=x86-64 -O2 -fno-omit-frame-pointer conftest.c -L. -LC:/opt/td-agent/embedded/lib -LC:/opt/td-agent/embedded/lib -L. -LC:/opt/td-agent/embedded/lib -fno-lto -m64 -lx64-msvcrt-ruby240 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char *argv)
6: {
7: return 0;
8: }
/
end */

Failed to save data for plugin storage under antivirus solution

Hello, i'm running fluentd (1.10.2) using td-agent (3.7.1) on Windows 2016

My FluentD config looks like:

<match>
  flush_interval 1s
  host xxx
  port 12345
  protocol udp
  @type gelf
</match>

<filter>
  @type record_transformer
  <record>
    message ${record[description]}
  </record>
</filter>

<source>
  channels application,system,security
  @id windows_eventlog
  <storage>
    persistent true
    @type local
  </storage>
  tag windows_eventlog
  @type windows_eventlog
</source>

<system>
  root_dir C:/opt/td-agent
</system>

And i'm seeing the following errors coming through on the logging stream:

[windows_eventlog] failed to save data for plugin storage to file path="C:/opt/td-agent/worker0/windows_eventlog/storage.json" tmp="C:/opt/td-agent/worker0/windows_eventlog/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/worker0/windows_eventlog/storage.json.tmp, C:/opt/td-agent/worker0/windows_eventlog/storage.json)"

I checked and can see that this directory does exist and the file C:/opt/td-agent/worker0/windows_eventlog/storage.json is created and has the following contents:

{"application":[541177,41519],"system":[648,54300],"security":[8973443,1]}

Any ideas why i might be getting a permission denied error? It appears that the service is running as System:
image

Not sure what else to check, any thoughts?

EventId from Windows Eventlog is not the same in windows_eventlog2 plugin

Describe the bug

Hi team,
We have a fluentd based logging agent. we use the windows_eventlog2 plugin for streaming window event logs.
Recently we have noticed a specific event name(): Service control manager which has event id 7306 in the window system.
When fluend agent reading this event via windows_eventlog2 input plugin, event id w.r.t this event Service control manager is 1073748860.

We have observed this issue only with this specific event. kindly let us know why this mismatch happening.
Screenshot 2022-08-17 at 4 46 43 PM
Capture2

To Reproduce

  1. Install fluend based agent on window machine.
  2. used fluend.conf similar to below
  3. used the following configuration:
  <source>
        @type windows_eventlog2
        tag test
        channels  Security, System, Application
        from_encoding  UTF-8
        encoding  UTF-8
        <storage>
            @type local
            persistent true
            path C:\testt\test\winevt.pos
        </storage>
    </source>

    <match 6a7371.**>
        @type stdout
    </match>

Expected behavior

windows_eventlog2 plugin should read event id as 7306 not 1073748860

Your Environment

- Fluentd version: latest version
- TD Agent version:
- Operating system: Window
- Kernel version:

Your Configuration

<source>
        @type windows_eventlog2
        tag test
        channels  Security, System, Application
        from_encoding  UTF-8
        encoding  UTF-8
        <storage>
            @type local
            persistent true
            path C:\testt\test\winevt.pos
        </storage>
    </source>

    <match 6a7371.**>
        @type stdout
    </match>`

Your Error Log

Attached screen where we can clearly see event id 1073748860

Additional context

Similar had been reported here graylog-labs/collector#50

How to remove contaminated Fluentd system message from event pipeline

Hi,
I have configured Fluentd on windows server (WIN 2012) and trying to tail customized application logs (which is present in C:/opt/td-agent/application.log) to elastic search. Each time when i configure and start the agent i could see that "fluentd worker is now running worker=0" message in Kibana but not my application logs. config details given below, please help to fix the issue.

config:

##INPUT 
<source>
  @type tail
  @id input_tail
  format single_value
  <parse>
  type none
  </parse>
  path /opt/td-agent/application.log
  pos_file /opt/td-agent/applog.pos
  tag server.app.log
</source>

##output config path
<match *.**>
  @type forward
  @type elasticsearch
  host elastic-search-hostname
  port 9200
  logstash_format false
  include_timestamp true
  index_name fluentd_server
</match>

parse_description in windows_eventlog2 is broken

I think parse_description true is broken. My config:

<source>
  @type windows_eventlog2
  @id windows_eventlog2
  channels Windows PowerShell,Microsoft-Windows-Sysmon/Operational,Security
  tag winevt.raw
  render_as_xml true
  parse_description true
  read_existing_events false
  <storage>
    @type local
    persistent true
    path C:\opt\td-agent\winlog.json
  </storage>
</source>

<match winevt.raw>
  @type file
  path C:\logs_out\fluentd\winlog
  # compress gzip
  <format>
    @type json
  </format>
  <buffer>
    timekey 5m
    timekey_use_utc true
    timekey_wait 1m
  </buffer>
</match>

What i am expecting is something that looks like this:

{
  "ProviderName": "Microsoft-Windows-Security-Auditing",
  "ProviderGUID": "{D441060A-9695-472B-90BC-24DCA9D503A4}",
  "EventID": "4798",
  "Qualifiers": "",
  "Level": "0",
  "Task": "13824",
  "Opcode": "0",
  "Keywords": "0x8020000000000000",
  "TimeCreated": "2019-06-19T03:10:01.982940200Z",
  "EventRecordID": "87028",
  "ActivityID": "",
  "RelatedActivityID": "{2599DE71-2F70-44AD-9DC8-C5FF2AE8D1EF}",
  "ThreadID": "16888",
  "Channel": "Security",
  "Computer": "DESKTOP-TEST",
  "UserID": "",
  "Version": "0",
  "DescriptionTitle": "A user's local group membership was enumerated.",
  "subject.security_id": "S-X-Y-Z",
  "subject.account_name": "DESKTOP-TEST$",
  "subject.account_domain": "WORKGROUP",
  "subject.logon_id": "0x3e7",
  "user.security_id": "S-XXX-YYY-ZZZ",
  "user.account_name": "Administrator",
  "user.account_domain": "DESKTOP-TEST",
  "process_information.process_id": "0xbac",
  "process_information.process_name": "C:\\Windows\\System32\\svchost.exe"
}

However what I am getting is:

{
  "ProviderName": "Microsoft-Windows-Sysmon",
  "ProviderGUID": "{5770385f-c22a-43e0-bf4c-06f5698ffbd9}",
  "EventID": "1",
  "Qualifiers": "",
  "Level": "4",
  "Task": "1",
  "Opcode": "0",
  "Keywords": "0x8000000000000000",
  "TimeCreated": "2023-03-06T18:15:15.560133900Z",
  "EventRecordID": "7154",
  "ActivityID": "",
  "RelatedActivityID": "",
  "ProcessID": "2936",
  "ThreadID": "4880",
  "Channel": "Microsoft-Windows-Sysmon/Operational",
  "Computer": "W10-SANDY-001",
  "UserID": "S-1-5-18",
  "Version": "5",
  "DescriptionTitle": "Process Create:\r\nRuleName: \r\nUtcTime: 2023-03-06 18:15:15.558\r\nProcessGuid: {84faa657-2db3-6406-0000-0010e59d5202}\r\nProcessId: 1336\r\nImage: C:\\opt\\td-agent\\bin\\ruby.exe\r\nFileVersion: 2.7.6p219\r\nDescription: Ruby interpreter (CUI) 2.7.6p219 [x64-mingw32]\r\nProduct: Ruby interpreter 2.7.6p219 [x64-mingw32]\r\nCompany: http://www.ruby-lang.org/\r\nOriginalFileName: ruby.exe\r\nCommandLine: C:\\opt\\td-agent\\bin\\ruby.exe -Eascii-8bit:ascii-8bit -h\r\nCurrentDirectory: c:\\opt\\td-agent\\\r\nUser: W10-SANDY-001\\Johnny Douche\r\nLogonGuid: {84faa657-1673-6405-0000-0020b4830100}\r\nLogonId: 0x183B4\r\nTerminalSessionId: 1\r\nIntegrityLevel: High\r\nHashes: MD5=949C42C68A780AB3AB2EE4730B56230D,SHA256=4815AC3DA6906A52031D0A21314493F66635D717125D644CFB3784396838F7DC\r\nParentProcessGuid: {84faa657-2dae-6406-0000-0010bf854f02}\r\nParentProcessId: 5988\r\nParentImage: C:\\opt\\td-agent\\bin\\ruby.exe\r\nParentCommandLine: \"C:\\opt\\td-agent\\bin\\ruby.exe\"  \"C:\\opt\\td-agent\\bin\\fluentd\" -c etc\\td-agent\\td-agent.conf"
}

Am I doing something wrong or something broken with the parser?

Windows service restart hagning with windows_eventlog2

Hello, i just recently deployed FluentD on Windows to all of our DEV machines and am noticing that when trying to restart the FluentD service, that it is failing to stop the underlying ruby processes causing the restart to hang and eventually fail.

Here is our config:

<ROOT>
  <source>
    channels application,system,security
    @id windows_eventlog2
    parse_description true
    read_existing_events false
    read_interval 2
    render_as_xml true
    tag "windows_eventlog"
    @type windows_eventlog2
    <parse>
      preserve_qualifiers true
      @type "winevt_xml"
    </parse>
    <storage>
      path "C:/opt/td-agent/windows_eventlog_pos"
      persistent true
      @type "local"
    </storage>
  </source>
  <filter windows_eventlog**>
    @type grep
    <exclude>
      key "EventID"
      pattern 4656
    </exclude>
  </filter>
  <filter windows_eventlog**>
    remove_keys Keywords
    @type record_transformer
    <record>
      short_message ${record["DescriptionTitle"]}
    </record>
  </filter>
  <filter **>
    enable_ruby true
    @type record_transformer
    <record>
      host #{Socket.gethostbyname(Socket.gethostname).first}
    </record>
  </filter>
  <match **>
    flush_interval 1s
    host logging.domain.tld
    port 12201
    protocol "udp"
    @type gelf
    use_record_host true
    <buffer>
      flush_mode interval
      retry_type exponential_backoff
      flush_interval 1s
    </buffer>
  </match>
</ROOT>

I don't see anything obvious in the logs other than the worker says it has stopped but the process keeps on running:

2020-06-18 15:27:27 -0400 [info]: starting fluentd-1.10.2 pid=2300 ruby="2.4.10"
2020-06-18 15:27:28 -0400 [info]: spawn command to main:  cmdline=["C:/opt/td-agent/embedded/bin/ruby.exe", "-Eascii-8bit:ascii-8bit", "C:/opt/td-agent/embedded/bin/fluentd", "-c", "C:/opt/td-agent/etc/td-agent/td-agent.conf", "-o", "C:/opt/td-agent/td-agent.log", "-x", "td-agent", "--under-supervisor"]
2020-06-18 15:27:29 -0400 [info]: #0 disable filter chain optimization because [Fluent::Plugin::RecordTransformerFilter, Fluent::Plugin::RecordTransformerFilter] uses `#filter_stream` method.
2020-06-18 15:27:30 -0400 [info]: adding filter pattern="windows_eventlog**" type="grep"
2020-06-18 15:27:30 -0400 [info]: adding filter pattern="windows_eventlog**" type="grep"
2020-06-18 15:27:30 -0400 [info]: adding filter pattern="windows_eventlog**" type="grep"
2020-06-18 15:27:30 -0400 [info]: adding filter pattern="windows_eventlog**" type="record_transformer"
2020-06-18 15:27:30 -0400 [info]: adding filter pattern="**" type="record_transformer"
2020-06-18 15:27:30 -0400 [info]: adding match pattern="**" type="gelf"
2020-06-18 15:27:31 -0400 [info]: adding source type="windows_eventlog2"
2020-06-18 15:27:31 -0400 [warn]: #0 define <match fluent.**> to capture fluentd logs in top level is deprecated. Use <label @FLUENT_LOG> instead
2020-06-18 15:27:31 -0400 [info]: #0 starting fluentd worker pid=4484 ppid=2300 worker=0
2020-06-18 15:27:31 -0400 [warn]: #0 [windows_eventlog2] This stored bookmark is incomplete for using. Referring `read_existing_events` parameter to subscribe: <BookmarkList>
</BookmarkList>, channel: application
2020-06-18 15:27:31 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 15:27:31 -0400 [warn]: #0 [windows_eventlog2] This stored bookmark is incomplete for using. Referring `read_existing_events` parameter to subscribe: <BookmarkList Direction='backward'>
</BookmarkList>, channel: system
2020-06-18 15:27:31 -0400 [info]: #0 fluentd worker is now running worker=0
2020-06-18 15:27:33 -0400 [info]: #0 disable filter chain optimization because [Fluent::Plugin::RecordTransformerFilter, Fluent::Plugin::RecordTransformerFilter] uses `#filter_stream` method.
2020-06-18 15:27:33 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 15:27:33 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 15:27:37 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
....
2020-06-18 18:17:55 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 18:18:25 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 18:18:31 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 18:19:03 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 18:19:43 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 18:21:13 -0400 [info]: Received graceful stop
2020-06-18 18:21:13 -0400 [info]: Worker 0 finished with status 0
2020-06-18 18:21:17 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 18:21:35 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
2020-06-18 18:21:55 -0400 [error]: #0 [windows_eventlog2] failed to save data for plugin storage to file path="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json" tmp="C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp" error_class=Errno::EACCES error="Permission denied @ rb_file_s_rename - (C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json.tmp, C:/opt/td-agent/windows_eventlog_pos/worker0/storage.json)"
...

Anything that i can check or try to help debug and fix this?

How does it keep track of forwarded events to the same channel

We are trying to see if forwarding events and then collecting them with fluentd is a better choice for us.

But how does it keep track of the forwarded events? When lookin in the storage file it look like this
{"wec-authentication":"<BookmarkList>\r\n <Bookmark Channel='WEC-Authentication' RecordId='3954582302' IsCurrent='true'/>\r\n</BookmarkList>"}

The RecordId='3954582302', but how does it keep track when different servers send different RecordId's from different channels

Example:
Server A sends EventRecordID 11920 from Security to the forwarded collecting channel X
Server B sends EventRecordID 219130 from Security to the forwarded collecting channel X
Server B sends EventRecordID 11910 from Application to the forwarded collecting channel X

FluentD collects everything from Channel X, how does it keep track of that?

image
EventRecordID and Channel from different servers but collected from the same forwarded channel

Original security message is removing when parse_description is true

@cosmo0920 ,
As per fluentd document, Description and EventData fields are removed when we set parse_description true. How to add Description field when we set parse_description true
https://github.com/fluent/fluent-plugin-windows-eventlog

Example config :-

<source>
  @type windows_eventlog2
  @id windows_eventlog2
  channels Application,System,Security,Windows PowerShell
  tag enbd-windows-secuirty-events
  render_as_xml false
  #parse_description true
  <storage>
    @type local
    persistent true
    path C:/opt/td-agent/etc/td-agent/pos/windowsecuritysevent.pos
  </storage>
</source>

Unable to send from all channels

I'm trying to send the following logs using fluent-plugin-windows-eventlog
Security, System, Directory Service, Active Directory Web Services, DFS Replication, Windows PowerShell, HardwareEvents

Only security and system are getting sent . All other channels don't

Log Parameters are changed for new plugin version windows_eventlog2.

Previously when we used plugin windows_eventlog, then we are getting event_type parameter in logs & bases on that we had designed the Loki query & made a Grafana Dashboard.
Now with new plugin windows_eventlog2 , this field is removed & no new parameter is giving this information.
So can i get the information of type of logs(i.e. Error, Warning or Information) for windows in new plugin windows_eventlogs2.
I had also observed that logs in Windows has one parameter called Level which is indicating this details but this field in converted into integer when i see the logs in Loki as per documentation.
Can you suggest any solution here that how can I get the event_type information for new plugin windows_eventlog2?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.