Skip to content

Instantly share code, notes, and snippets.

@radu-gheorghe
radu-gheorghe / securityconfig-secret.yaml
Created September 15, 2023 04:54
Example OpenSearch securityconfig secret for the Kubernetes Operator
apiVersion: v1
kind: Secret
metadata:
name: securityconfig-secret
type: Opaque
stringData:
internal_users.yml: |-
_meta:
type: "internalusers"
config_version: 2
@radu-gheorghe
radu-gheorghe / zookeeper.yaml
Created September 1, 2023 13:24
Zookeeper service for Solr on Kubernetes
apiVersion: v1
kind: Service
metadata:
name: zk-hs
labels:
app: zk
spec:
ports:
- port: 2888
name: server
@radu-gheorghe
radu-gheorghe / pom.xml
Created August 26, 2022 13:45
pom.xml for custom Solr plugin
<!-- NOTE: if you landed here by accident, look for Solr plugin under https://sematext.com/blog and you'll get the context -->
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.mysortplugin</groupId>
<artifactId>mysortplugin</artifactId>
@radu-gheorghe
radu-gheorghe / logstash.conf
Created March 17, 2016 08:31
logstash grok filter for Elasticsearch logs
filter {
if [type] == "elasticsearch" {
grok {
match => [ "message", "\[%{TIMESTAMP_ISO8601:timestamp}\]\[%{DATA:severity}%{SPACE}\]\[%{DATA:source}%{SPACE}\]%{SPACE}(?<message>(.|\r|\n)*)" ]
overwrite => [ "message" ]
}
if "_grokparsefailure" not in [tags] {
grok { # regular logs
match => [
@radu-gheorghe
radu-gheorghe / example.log.parsed.snippet
Created September 23, 2015 06:14
logstash json_lines issue
{"message":"proxy-435.dialup.xtra.co.nz - - [22/Apr/2009:18:52:51 +1200] \"GET /images/photos/455.jpg HTTP/1.1\" 200 986 \"-\" \"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13\" \"-\"","@version":"1","@timestamp":"2015-04-16T17:35:24.585Z","host":"rgheorghe-suse.rgheorghe-local","path":"/opt/example.log.raw","clientip":"proxy-435.dialup.xtra.co.nz","ident":"-","auth":"-","timestamp":"22/Apr/2009:18:52:51 +1200","verb":"GET","request":"/images/photos/455.jpg","httpversion":"1.1","response":"200","bytes":"986","referrer":"\"-\"","agent":"\"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13\""}
{"message":"proxy-435.dialup.xtra.co.nz - - [22/Apr/2009:18:52:51 +1200] \"GET /images/nav/tab_left_middle.gif HTTP/1.1\" 200 1020 \"-\" \"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13\" \"-\"","@version":"1",
@radu-gheorghe
radu-gheorghe / repro.sh
Created February 5, 2015 09:51
Elasticsearch significant terms background filtering size oddities
curl -XDELETE localhost:9200/test
curl -XPOST localhost:9200/test/test -d '{"a": "foo"}'
curl -XPOST localhost:9200/test/test -d '{"a": "foo"}'
curl -XPOST localhost:9200/test/test -d '{"a": "foo2"}'
curl -XPOST localhost:9200/test/test -d '{"a": "foo2"}'
curl -XPOST localhost:9200/test/test -d '{"a": "foo"}'
curl localhost:9200/test/_refresh
# ElasticsearchIllegalArgumentException[supersetFreq > supersetSize, in JLHScore.score(..)]
curl 'localhost:9200/test/_search?pretty&search_type=count' -d '{
@radu-gheorghe
radu-gheorghe / limit.json
Created September 11, 2014 08:45
limit filter
{
"from": 0,
"size": 25,
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"bool": {
{
"size": 10,
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"multi_match": {
"analyzer": "whitespace_shingle",
@radu-gheorghe
radu-gheorghe / rsyslog compile error
Created August 26, 2014 14:30
rsyslog compile error
msg.c: In function 'getJSONPropVal':
msg.c:2736:3: warning: 'json_object_object_get' is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
field = json_object_object_get(parent, (char*)leaf);
^
msg.c: In function 'msgGetJSONPropJSON':
msg.c:2789:2: warning: 'json_object_object_get' is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
*pjson = json_object_object_get(parent, (char*)leaf);
^
In file included from /usr/include/json/linkhash.h:16:0,
from /usr/include/json/json.h:22,
@radu-gheorghe
radu-gheorghe / boost_by_id.json
Created August 20, 2014 10:02
boost specific titles
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "gospel",
"fields": [
"title.raw^60",
"authors.raw^40",
"subjects.raw^20",