Skip to content

Instantly share code, notes, and snippets.

View andrewkroh's full-sized avatar

Andrew Kroh andrewkroh

View GitHub Profile
@andrewkroh
andrewkroh / filebeat.filestream-evtx_dump.yml
Last active November 1, 2023 01:17
Ingest Windows event logs to Elasticsearch on Linux using evtx_dump and Filebeat
---
filebeat.inputs:
# Consume output from
# evtx_dump --dont-show-record-number -o xml <file.evtx> > /tmp/samples/file.evtx.xml
# See https://github.com/omerbenamram/evtx.
- type: filestream
id: evtx_dump_xml
parsers:
- multiline:
@andrewkroh
andrewkroh / filebeat.udp-cef-extrahop.yml
Last active October 24, 2023 20:41
ExtraHop CEF logging to Filebeat
filebeat.inputs:
- host: localhost:9514
id: udp-extrahop-cef-9514
type: udp
processors:
- convert:
mode: copy
fields:
- { from: "message", to: "event.original" }
@andrewkroh
andrewkroh / filebeat.cel.yml
Created October 1, 2023 19:32
Filebeat CEL input - ingest complete config file when it changes
---
filebeat.inputs:
- type: cel
id: config-123-watcher
interval: 1m
resource:
url: file:///etc/conf.d/foo.conf
program: |
file(state.url).as(content, content.sha256().hex().as(hash, {
@andrewkroh
andrewkroh / filebeat.journald-kubelet.yml
Last active September 22, 2023 20:29
Filebeat - processing kubelet json logs read from journald
filebeat.inputs:
- type: journald
processors:
# For https://kubernetes.io/docs/concepts/cluster-administration/system-logs/#json-log-format
- if:
and:
- equals.journald.process.name: kubelet
- regexp.message: '^{'
then:
# 'kubelet' should be mapped as a flattened field in ES because
@andrewkroh
andrewkroh / beat.yml
Last active March 10, 2023 15:04
Beat script processor to filter out IPv6
processors:
- script:
# This uses a Beat script processor to include only ipv4 addresses
# in the host.ip field. This would need to placed after the add_host_metadata
# processor.
#
# It would be a lot more efficient to have add_host_metadata allow controlling
# what addresses were included because this has to execute for every event.
#
# References:
@andrewkroh
andrewkroh / netusergetinfo.go
Last active June 3, 2022 02:04
NetUserGetInfo tester tool for Windows
package main
import (
"flag"
"log"
"os/user"
"syscall"
"unsafe"
"golang.org/x/sys/windows"
@andrewkroh
andrewkroh / winlogbeat.yml
Created May 19, 2022 17:47
Winlogbeat script to log specific event IDs
winlogbeat.event_logs:
- name: Security
ignore_older: 1h
processors:
- script:
lang: javascript
source: |
var console = require("console");
var ids = {
@andrewkroh
andrewkroh / filebeat-to-fleet.md
Last active January 17, 2023 20:26
Routing Filebeat data to a Fleet integration data stream

DRAFT: Routing Filebeat data to a Fleet integration data stream

This is an unofficial tutorial that may be useful to users that are in the process of migrating to to Elastic Agent and Fleet. It explains the steps to route some Filebeat data into a data stream managed by a Fleet integration package.

Install the Fleet integration

Installing a Fleet integration sets up all of its data streams and dashboards. There are two methods to install. In these examples we install the Hashicorp Vault 1.3.1 integration.

Use Kibana (easiest)

@andrewkroh
andrewkroh / wireguard-logger.sh
Last active September 1, 2022 21:42
Bash script to dump wireguard peers to JSON
#!/usr/bin/env bash
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
@andrewkroh
andrewkroh / 46203-dimmer.xml
Last active January 6, 2021 00:15
Home Assistant 2020.12.2 Patch for GE Jasco jasco_products_unknown_type_4944_id_3235
<!-- GE(Jasco) 46203 Z-Wave Plus Dimmer Switch -->
<!-- Configuration Parameters - per http://products.z-wavealliance.org/products/3323 -->
<Product Revision="1" xmlns="https://github.com/OpenZWave/open-zwave">
<MetaData>
<MetaDataItem name="OzwInfoPage">http://www.openzwave.com/device-database/0063:3235:4944</MetaDataItem>
<MetaDataItem name="ProductPic">images/ge/46203-dimmer.png</MetaDataItem>
<MetaDataItem id="3235" name="ZWProductPage" type="4944">https://products.z-wavealliance.org/products/3323/</MetaDataItem>
<MetaDataItem name="Name">In-Wall Smart Dimmer </MetaDataItem>
<MetaDataItem name="ProductManual">https://products.z-wavealliance.org/ProductManual/File?folder=&amp;filename=MarketCertificationFiles/3323/14294.46203.ZW3010%20Binder.pdf</MetaDataItem>
<MetaDataItem id="3235" name="FrequencyName" type="4944">U.S. / Canada / Mexico</MetaDataItem>