Last active
January 31, 2022 09:29
-
-
Save pgomulka/285b4daa6a48ac6c17207b98fa06337e to your computer and use it in GitHub Desktop.
log generation commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create index test_1 | |
curl --request PUT \ | |
--url http://localhost:9200/test_1 \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'Content-Type: application/json' \ | |
--header 'X-Opaque-ID: myApp1' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' | |
# set index settings | |
curl --request PUT \ | |
--url http://localhost:9200/test_1/_settings \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'Content-Type: application/json' \ | |
--header 'X-Opaque-ID: myApp1' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' \ | |
--data '{"settings": { | |
"index.search.slowlog.threshold.query.warn": "100ms", | |
"index.search.slowlog.threshold.query.info": "100ms", | |
"index.search.slowlog.threshold.query.debug": "0ms", | |
"index.search.slowlog.threshold.query.trace": 0, | |
"index.indexing.slowlog.threshold.index.trace": 0 | |
} | |
}' | |
#index document - with full length | |
curl --request POST \ | |
--url http://localhost:9200/test_1/_doc \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'Content-Type: application/json' \ | |
--header 'X-Opaque-ID: myApp1' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' \ | |
--data '{ | |
"a":"b" | |
}' | |
##INDEXING SLOW LOG | |
# set index settings with limited length | |
curl --request PUT \ | |
--url http://localhost:9200/test_1/_settings \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'Content-Type: application/json' \ | |
--header 'X-Opaque-ID: myApp1' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' \ | |
--data '{"settings": { | |
"index.search.slowlog.threshold.query.warn": "100ms", | |
"index.search.slowlog.threshold.query.info": "100ms", | |
"index.search.slowlog.threshold.query.debug": "0ms", | |
"index.search.slowlog.threshold.query.trace": 0, | |
"index.indexing.slowlog.threshold.index.trace": 0 | |
} | |
}' | |
#index document - with limited length | |
curl --request POST \ | |
--url http://localhost:9200/test_1/_doc \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'Content-Type: application/json' \ | |
--header 'X-Opaque-ID: myApp1' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' \ | |
--data '{ | |
"a":"b" | |
}' | |
## SEARCH SLOW LOG | |
# search with xopaqueid and trace.id | |
curl --request GET \ | |
--url http://localhost:9200/test_1/_search \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'Content-Type: application/json' \ | |
--header 'X-Opaque-ID: myApp1' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' | |
#search with trace.id only | |
curl --request GET \ | |
--url http://localhost:9200/test_1/_search \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'Content-Type: application/json' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' | |
#search without trace.id nor xopaqueid | |
curl --request GET \ | |
--url http://localhost:9200/test_1/_search \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'Content-Type: application/json' | |
AUDIT logs | |
-enable audit logs in elasticsearch.yml | |
xpack.security.audit.enabled: true | |
start trial license | |
curl --request POST \ | |
--url 'http://localhost:9200/_license/start_trial?acknowledge=true' \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'Content-Type: application/json' | |
access granted new index with ids | |
curl --request PUT \ | |
--url http://localhost:9200/test_1 \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' \ | |
--header 'X-Opaque-ID: myApp1' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' | |
access granted new index no ids | |
curl --request PUT \ | |
--url http://localhost:9200/test_2 \ | |
--header 'Authorization: Basic ZWxhc3RpYzpwYXNzd29yZA==' | |
anonymous access denied | |
curl --request PUT \ | |
--url http://localhost:9200/test_3 \ | |
--header 'X-Opaque-ID: myApp1' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' | |
###DEPRECATION LOGS | |
data path deprecation warning | |
curl --request PUT \ | |
--url https://localhost:9200/testindex2/ \ | |
--header 'Authorization: Basic ZWxhc3RpYzo0NUloYVYyRkhMdnhrMzlQR21pRw==' \ | |
--header 'Content-Type: application/json' \ | |
--header 'X-Opaque-Id: myAppId' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' \ | |
--data '{ | |
"settings" : { | |
"index" : { | |
"number_of_shards" : 3, | |
"number_of_replicas" : 1, | |
"data_path": "/tmp/dummy" | |
} | |
} | |
}' | |
merge at once deprecation critical | |
curl --request PUT \ | |
--url https://localhost:9200/testindex2/ \ | |
--header 'Authorization: Basic ZWxhc3RpYzo0NUloYVYyRkhMdnhrMzlQR21pRw==' \ | |
--header 'Content-Type: application/json' \ | |
--header 'X-Opaque-Id: myAppId' \ | |
--header 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' \ | |
--data '{ | |
"settings" : { | |
"index" : { | |
"number_of_shards" : 3, | |
"number_of_replicas" : 1, | |
"merge.policy.max_merge_at_once_explicit": 20 | |
} | |
} | |
}' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment