EExcel 丞燕快速查詢2

EExcel 丞燕快速查詢2
EExcel 丞燕快速查詢2 https://sandk.ffbizs.com/

ELK filebeat logstash FXXX

Use filebeat nginx module send nginx log to logstash or driect to elastick all get error!!

BUT some nginx log record can send success. That success records try to copy to other VM that have filebeat and logstash, try to send again. all get error!!



filebeat resend log file

https://stackoverflow.com/questions/41703689/how-do-i-force-rebuild-logs-data-in-filebeat-5




sudo service filbeat stop

mv /var/lib/filebeat/registry /var/lib/filebeat/registry.old

sudo service filbeat start

[轉]ELK:kibana使用的lucene查询语法

https://segmentfault.com/a/1190000002972420


通配符
? 匹配单个字符
* 匹配0到多个字符

kiba?a, el*search

? * 不能用作第一个字符,例如:?text *text


====================


正则
es支持部分正则功能,性能较差
name:/joh?n(ath[oa]n)/


====================


模糊搜索
quikc~ brwn~ foks~
~:在一个单词后面加上~启用模糊搜索,可以搜到一些拼写错误的单词

first~ 这种也能匹配到 frist

还可以设置编辑距离(整数),指定需要多少相似度
cromm~1 会匹配到 from 和 chrome
默认2,越大越接近搜索的原始值,设置为1基本能搜到80%拼写错误的单词


====================


逻辑操作
AND
OR

+:搜索结果中必须包含此项
-:不能含有此项
+apache -jakarta test aaa bbb:结果中必须存在apache,不能有jakarta,剩余部分尽量都匹配到


====================


分组
(jakarta OR apache) AND jakarta



====================



转义特殊字符
+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /
以上字符当作值搜索的时候需要用\转义
\(1\+1\)\=2用来查询(1+1)=2


====================

docker log put where

https://stackoverflow.com/questions/33017329/where-is-a-log-file-with-logs-from-a-container

get container id

docker ps |grep < container name >

get container log

/var/lib/docker/containers/< container id >/< container id >-json.log



elk 清除 indices delete clean windows curator

ELK 教學 - 定期清除 Elasticsearch 資料
https://blog.johnwu.cc/article/elk-purge-elasticsearch-index.html

https://www.elastic.co/guide/en/elasticsearch/client/curator/current/configfile.html

https://www.elastic.co/guide/en/elasticsearch/client/curator/current/ex_delete_indices.html

https://anjia0532.github.io/2017/04/06/elasticsearch-delete-indices-by-date/


config.yml

# Remember, leave a key empty if there is no value.  None will be a string,
# not a Python "NoneType"
client:
  hosts:
    - xxx.xxx.xxx.xxx
  port: 9200
  url_prefix:
  use_ssl: False
  certificate:
  client_cert:
  client_key:
  ssl_no_validate: False
  http_auth:
  timeout: 30
  #timeout: 60
  master_only: False

logging:
  loglevel: INFO
  logfile:
  logformat: default
  blacklist: ['elasticsearch', 'urllib3']


curator_filebeat.yml

# Remember, leave a key empty if there is no value.  None will be a string,
# not a Python "NoneType"
#
# Also remember that all examples have 'disable_action' set to True.  If you
# want to use this action as a template, be sure to set this to False after
# copying it.
actions:
  1:
    action: delete_indices
    description: >-
      Delete indices older than 30 days (based on index name), for logstash-
      prefixed indices. Ignore the error if the filter does not result in an
      actionable list of indices (ignore_empty_list) and exit cleanly.
    options:
      ignore_empty_list: True
      disable_action: False
    filters:
    - filtertype: pattern
      kind: prefix
      value: filebeat-
    - filtertype: age
      source: name
      direction: older
      timestring: '%Y.%m.%d'
      unit: days
      unit_count: 30


curator_heartbeat.yml

# Remember, leave a key empty if there is no value.  None will be a string,
# not a Python "NoneType"
#
# Also remember that all examples have 'disable_action' set to True.  If you
# want to use this action as a template, be sure to set this to False after
# copying it.
actions:
  1:
    action: delete_indices
    description: >-
      Delete indices older than 15 days (based on index name), for logstash-
      prefixed indices. Ignore the error if the filter does not result in an
      actionable list of indices (ignore_empty_list) and exit cleanly.
    options:
      ignore_empty_list: True
      disable_action: False
    filters:
    - filtertype: pattern
      kind: prefix
      value: heartbeat-
    - filtertype: age
      #source: name
      source: creation_date
      direction: older
      timestring: '%Y.%m.%d'
      unit: days
      unit_count: 15


curator.exe --config config.yml curator_filebeat.yml


curator.exe --config config.yml curator_heartbeat.yml


If very slow or get error, try use curl command line. Delete some indices then use curator again.


curl "http://localhost:9200/_cat/indices?v&h=i"


curl -XDELETE "http://xxx.xxx.xxx.xxx:9200/filebeat-6.5.1-2018.12.17"

Flutter UI - Furniture App



How to UI show with flutter

And

Some flutter action

Vault

今天找到一篇有分享經驗的文章 http://sueboy.blogspot.com/2019/01/vault.html

1、量大 Vault有機會掛

2、Vault的重啟 需要特定 5把金錀 3把同意 才能開啟,所以人要登入,不然就是要模擬操作 但模擬操作就失去意義

3、服務被更新重啟,又會發生2的情況

Vault就是簡單說就是管理 帳號、密碼、token、金錀,配合上ACL url ,有群組權限等功能

專案角度就是 啟動服務(docker)後,前端直接跟Vault做驗證登入,api url 呼叫是否有權限等,都是Vault會給出回應 能登入否 能存取否

更進階是token 金鑰 時效等等都可以設定,可用Vault的管理介面

當然 會面臨的第一個問題,怎麼建立account 、怎麼判斷(go server要去呼叫Vault,前端也可以呼叫Vault),再來要多一個維護的系統,而且這個系統是最重要的,一掛,所以有的系統都登入不了


真的有比較好嗎?

1、要多一個系統做管理

2、要再多學一個系統操作、設定

3、真的掛了,運用本身沒掛,那.........

4、有bug或是無法滿足特定條件權限時,怎麼辨


好處:
統一方式,除非將來Vault沒了,不然很多專案可以使用

Vault k8s



https://medium.com/getamis/vault-dynamic-credentials-fd651d6c28a9




https://medium.com/@gmaliar/dynamic-secrets-on-kubernetes-pods-using-vault-35d9094d169

Vault問題


https://medium.com/getamis/vault-dynamic-credentials-fd651d6c28a9



踩雷區
應同事要求特別寫一下 vault 的雷區,其實上面的 demo.js 最重要的地方就在於 graceful shutdown 時要把目前使用的 credential 給撤銷掉。

你可能會覺得這個 credential 放著也還好,反正時候到了就會過期,不會有太多影響。BUT!! 假如你跟我們一樣 dev 環境是每個 commit 都會 deploy,而且 credential 的過期日期設定的比較長,比如說一個月的話,每天十個 commit,kubernetes 裡面有十個 pod,每個 pod 可能會用到兩三個由 Vault 管理的動態憑證的話,你在資料庫或 IAM User 會膨脹的很快,很快地你就會發現這些為數眾多的 credentials 管理上會造成困難,甚至拖累整個開發環境。

像最近我突然知道原來 AWS IAM User 的預設上限是 5000 人…。

當你有很多 IAM User 的時候,雖然可以透過指令一次把所有由 Vault 管理的 IAM User 撤銷,但是就我們的經驗來說大量 revoke IAM User 的時候,vault 大多都會 timeout (也有可能是因為我們 dev 環境開的資源太少),所以要執行很多次才能把所有使用者刪除,其中還有可能會因為資源太少導致 Vault crash 的狀況,在 production 的狀況 vault 重啟會需要 unseal,此時就會伴隨許多痛苦,甚至 vault 會被不停地打掛,到最後只好到 backend storage 跟 AWS console 裡面手動刪除這些資料。

總之請大家別忘了在服務裡面加上 graceful shutdown 時同時也去撤銷 vault 裡面的 credential,免得原本採用 Vault 是要降低痛苦卻適得其反,讓痛苦太多,收穫太少。

結語

另外一個方面,當 vault 在 production 環境使用時,會有許多為了安全性而設計的麻煩事情,比如說當啟動 vault 時會需要使用 unseal key 把 vault 解封 (unseal) 才可以使用,所以比如說 CoreOS 自行重新開機更新 kernel 時,vault 服務就會停擺需要等管理者來 unseal 的狀況,所以架設時有許多狀況需要細部設定。