<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>https://wiki.webko.net.ua/index.php?action=history&amp;feed=atom&amp;title=ELK_useful_commands</id>
	<title>ELK useful commands - История изменений</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.webko.net.ua/index.php?action=history&amp;feed=atom&amp;title=ELK_useful_commands"/>
	<link rel="alternate" type="text/html" href="https://wiki.webko.net.ua/index.php?title=ELK_useful_commands&amp;action=history"/>
	<updated>2026-05-03T23:57:09Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.webko.net.ua/index.php?title=ELK_useful_commands&amp;diff=650&amp;oldid=prev</id>
		<title>Sol: Новая страница: «Show cluster health | pretty formated &lt;syntaxhighlight lang=&quot;bash&quot;&gt; curl -XGET 'IP-OF-ELASTIC-SERVER:9200/_cluster/health?pretty' &lt;/syntaxhighlight&gt;  Show cluster…»</title>
		<link rel="alternate" type="text/html" href="https://wiki.webko.net.ua/index.php?title=ELK_useful_commands&amp;diff=650&amp;oldid=prev"/>
		<updated>2020-02-21T08:47:39Z</updated>

		<summary type="html">&lt;p&gt;Новая страница: «Show cluster health | pretty formated &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; curl -XGET &amp;#039;IP-OF-ELASTIC-SERVER:9200/_cluster/health?pretty&amp;#039; &amp;lt;/syntaxhighlight&amp;gt;  Show cluster…»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Show cluster health | pretty formated&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XGET 'IP-OF-ELASTIC-SERVER:9200/_cluster/health?pretty'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show cluster settings | pretty formated&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XGET 'IP-OF-ELASTIC-SERVER:9200/_cluster/settings?pretty'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show all indexes&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XGET 'IP-OF-ELASTIC-SERVER:9200/_cat/indices?v'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show all indexes which start with logsta*&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XGET 'IP-OF-ELASTIC-SERVER:9200/_cat/indices/logsta*?v&amp;amp;s=index'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show all indexes/shards in state unassigned&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XGET -H 'Content-Type: application/json' http://IP-OF-ELASTIC-SERVER:9200/_cat/shards | grep UNASSIGNED&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlock all indexes manually&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XPUT -H &amp;quot;Content-Type: application/json&amp;quot; http://IP-OF-ELASTIC-SERVER:9200/_all/_settings -d '{&amp;quot;index.blocks.read_only_allow_delete&amp;quot;: null}'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get default logstash template from elasticsearch | pretty formated | stored in temp directory&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XGET 'IP-OF-ELASTIC-SERVER:9200/_template/logstash?pretty' &amp;gt; /tmp/logstash-template.json&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Upload modified logstash template to elasticsearch from directory where logstash-template.json exists | hint dont forget to remove the logstash parameter in the file&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XPUT -H 'Content-Type: application/json' 'IP-OF-ELASTIC-SERVER:9200/_template/logstash' -d &amp;quot;@logstash-template.json&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run logstash from commandline with all config files in debug mode&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/usr/share/logstash/bin/logstash --path.settings /etc/logstash/ -r -f &amp;quot;/etc/logstash/conf.d/*&amp;quot; --log.level debug&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run logstash from commandline with specific config file in debug mode&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/usr/share/logstash/bin/logstash --path.settings /etc/logstash/ -r -f &amp;quot;/etc/logstash/conf.d/00-test.config&amp;quot; --log.level debug&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the number of replicas at one existing index&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XPUT -H 'Content-Type: application/json' 'IP-OF-ELASTIC-SERVER:9200/.alert/_settings' -d '{ &amp;quot;index&amp;quot; : {&amp;quot;number_of_replicas&amp;quot; : 0}}'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the number of replicas at multiple existing indexes | sets number_of_replicas:0 to all cisco indexes from the year 2018&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XPUT -H 'Content-Type: application/json' 'IP-OF-ELASTIC-SERVER:9200/logstash-cisco-2018.*.*/_settings' -d '{ &amp;quot;index&amp;quot; : {&amp;quot;number_of_replicas&amp;quot; : 0}}'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Delete all indexes from a year&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XDELETE 'IP-OF-ELASTIC-SERVER:9200/logstash-cisco-2018.*.*'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create an index manuall from cli via curl | name of index is aa_test_index | number_of_shards:1 and number_of_replicas:0&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XPUT -H 'Content-Type: application/json' 'IP-OF-ELASTIC-SERVER:9200/aa_test_index?pretty' -d '{&amp;quot;settings&amp;quot; : {&amp;quot;index&amp;quot; : {&amp;quot;number_of_shards&amp;quot; : 1,&amp;quot;number_of_replicas&amp;quot; : 0 }}}'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create an index manuall from cli by using logstash | name of index is aa_test_index_from_cli&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/usr/share/logstash/bin/logstash --path.settings &amp;quot;/etc/logstash/&amp;quot; -e 'input { stdin { } } output { elasticsearch { hosts =&amp;gt; &amp;quot;IP-OF-ELASTIC-SERVER:9200&amp;quot; index =&amp;gt; &amp;quot;aa_test_index_from_cli&amp;quot; } }'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logstash config test&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/usr/share/logstash/bin/logstash --path.settings &amp;quot;/etc/logstash/&amp;quot; --config.test_and_exit -f /etc/logstash/conf.d/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set existing index to read-only | ! needed for shrinking shards ! | this command sets all shards from december 2018 to read-only&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XPUT -H 'Content-Type: application/json' 'IP-OF-ELASTIC-SERVER:9200/logstash-cisco-2018.12.*/_settings' -d '{&amp;quot;index.blocks.write&amp;quot;: true}'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Shrink existing shards | shrinks the data from existing index &amp;quot;logstash-cisco-2018.12.24&amp;quot; to the new &amp;quot;smaller index&amp;quot; logstash-cisco-2018.12.24.shrinked | copy all index settings to new one | number_of_shards:1 and number_of_replicas:0 | using best_compression | disable read-only mode&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
curl -POST -H 'Content-Type: application/json' 'IP-OF-ELASTIC-SERVER:9200/logstash-cisco-2018.12.24/_shrink/logstash-cisco-2018.12.24-shrinked?copy_settings=true' -d '{ &amp;quot;settings&amp;quot;: { &amp;quot;index.number_of_replicas&amp;quot;: 0, &amp;quot;index.number_of_shards&amp;quot;: 1, &amp;quot;index.codec&amp;quot;: &amp;quot;best_compression&amp;quot;, &amp;quot;index.routing.allocation.require._name&amp;quot;: null, &amp;quot;index.blocks.write&amp;quot;: null }, &amp;quot;aliases&amp;quot;: { &amp;quot;my_search_indices&amp;quot;: {}  }}'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Increase the elasticsearch shard limit from 1000 to 5000 for each node&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XPUT -H 'Content-Type: application/json' 'IP-OF-ELASTIC-SERVER:9200/_cluster/settings' -d '{ &amp;quot;persistent&amp;quot; : {&amp;quot;cluster.max_shards_per_node&amp;quot; : 5000}}'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the Cluster Metadata Administrator Email address&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -XPUT -H 'Content-Type: application/json' 'IP-OF-ELASTIC-SERVER:9200/_cluster/settings' -d '{ &amp;quot;persistent&amp;quot; : {&amp;quot;cluster.metadata.administrator&amp;quot; : &amp;quot;admin@yourdomain.com&amp;quot;}}'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Категория:ELK]]&lt;/div&gt;</summary>
		<author><name>Sol</name></author>
	</entry>
</feed>