页面“Org-mode”与“Filebeat nginx log”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
 +
[[category:ops]]
  
Emacs 的 Org-mode 在一定程度上可以替代 OneNote,有些方面甚至更好
+
=ins and config=
=pre=
+
==Download and install Filebeat==
 
 
[https://i.linuxtoy.org/docs/guide/ch32s05.html#id3156706 第 32 章 组织你的意念:Emacs org mode 事件]
 
<pre>
 
Emacs键盘命令的约定表示方法:
 
 
 
C 代表 Ctrl 键
 
M 代表 Alt 键
 
S 代表 Shift 键
 
以上三个按键单独按下没有意义,用 - 号表示它们搭配使用的按键
 
用空格连接的一系列符号表示顺序按下符号所代表的按键
 
其他符号: LEFT/RIGHT/UP/DOWN 分别代表的左右上下方向键, TAB 即 Tab 键, RET 代表 Enter 键
 
例如:
 
C-x 表示同时按下Ctrl和x字符键
 
C-S-TAB 表示同时按下Ctrl, Shift和Tab键
 
M-x org-mode 表示先同时按下Alt和x字符键,再键盘输入org-mode字符串
 
C-x C-s 表示先同时按Ctrl和x字符键,然后同时按下Ctrl和s字符键
 
C-c C-e hh 表示先同时按Ctrl和c字符键,然后同时按下Ctrl和e字符键,最后键盘输入hh
 
</pre>
 
 
 
=emacs-gtk=
 
<pre>
 
让选中可以高亮
 
自己打开随便看下 居然就看到了 不错
 
emacs-gtk  --> Options --> customize emacs  --> custom themes  -->  个人感觉 adwaita 还不错
 
save theme settings
 
</pre>
 
 
 
=install=
 
 
<pre>
 
<pre>
Emacs 22 以后的版本已经集成了 org-mode,打开 .org 扩展的文件会自动进入 org 模式。
 
vi  ~/.emacs #添加源
 
(require 'package)
 
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
 
  
  
# 如果用老版本的emacs 或者你想安装
+
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.12.0-amd64.deb
Get it with M-x package-install RET org RET (
+
sudo dpkg -i filebeat-7.12.0-amd64.deb
 
</pre>
 
</pre>
 
+
==Edit the configuration ==
=进入Org模式=
 
 
<pre>
 
<pre>
 +
Modify /etc/filebeat/filebeat.yml to set the connection information:
  
1. org作为后缀名
+
output.elasticsearch:
2. 文件的第一个非空行包含: -*-org-*-
+
  hosts: ["<es_url>"]
 
+
  username: "elastic"
 +
  password: "<password>"
 +
setup.kibana:
 +
  host: "<kibana_url>"
  
C-x C-f ~/test/test.org
+
Where <password> is the password of the elastic user, <es_url> is the URL of Elasticsearch, and <kibana_url> is the URL of Kibana.
  
1.打开后缀名为org的文件自动进入org-mode模式
 
2.在init.el配置文件中设置某类文件的编辑模式为org,如txt类文件:
 
 
      (add-to-list 'auto-mode-alist '("\\.txt\\'" . org-mode))
 
 
3.用Emacs打开文件后使用主模式选择命令( M-x org-mode )
 
 
4.任意文件名,如果文件的第一个非空行包含: -*-org-*- ,用Emacs打开该文件后会自动使用org-mode模式。
 
 
后面这种方式对于使用Emacs编辑程序文件尤其方便,无需改变文件的后缀名。
 
 
</pre>
 
</pre>
  
=TODO=
+
==Enable and configure the nginx module ==
<pre>
 
输入C-c . 会出现一个日历,我们点选相应的时间即可插入
 
 
 
*  待办事项(TODO )
 
  TODO是org-mode最具特色的一个功能,也是org-mode设计的初衷,org-mode的作者本意是用其来完成一个个人时间管理程序(GDT)。因此,可以用org-mode来做一个个人时间管理工具!   下面我们来看怎么写TODO。TODO 也是一类标题,因此也需要用*开头,在Emacs中输入 * 然后快捷键如下
 
C-c C-t 按照 无状态->TODO->DONE->无状态 的顺序更改任务状态
 
 
 
** TODO 洗衣服
 
可以看到当中的TODO变成了红色,我们讲光标移到该行,按C-c C-t,则发现TODO变成了DONE(这个序列可以自己定义,详见org-mode手册)。org-mode兼有了标题和列表的功能,也可以添加checkbox和完成进度,除此之外,还可以设计优先级。 我们输入:
 
  
*** TODO [# A] 任务1
 
*** TODO [# B] 任务2
 
*** TODO 总任务 [33%]
 
**** TODO 子任务1
 
**** TODO 子任务2 [0%]
 
      - [-] subsub1 [1/2]
 
      - [ ] subsub2
 
      - [X] subsub3
 
    **** DONE 一个已完成的任务
 
 
一些常用操作如下: - C-c C-t 变换TODO的状态 - C-c / t以树的形式展示所有的 TODO - C-c C-c 改变 checkbox状态 - C-c, 设置优先级(方括号里的ABC) - M-S-RET 插入同级TODO标
 
</pre>
 
 
== 快速创建任务的操作==
 
 
<pre>
 
<pre>
快捷键   功能                                           备注(return is enter)
+
sudo filebeat modules enable nginx
  
M-<return> 在当前 headline 后建立一个同级 headline 无 headline 时创建一个一级 headline
+
Modify the settings in the /etc/filebeat/modules.d/nginx.yml file.
 
 
M-S-return 在当前任务后建立一个同级任务,标记为TODO(好像无效) 同下 (这个试过有效)
 
C-S-return 在当前任务的内容后面建立一个同级任务,标记为TODO 无任务时创建一级任务,标记为TODO
 
  
 
</pre>
 
</pre>
  
==自定义状态序列 ==
+
== Start Filebeat==
<pre>
 
如果只想在某个文件中为其设置独有的关键词序列,那么可以在org文件的头部用"#+SEQ_TODO"来进行设置:
 
 
 
;+SEQ_TODO: TODO DOING DONE
 
 
 
;我的emacs 配置 .emacs
 
(setq org-todo-keywords '((sequence "TODO" "DOING" "DONE")))
 
(setq org-todo-keyword-faces '(("TODO" . "red")
 
                              ("DOING" . "yellow")
 
                              ("DONE" . "green")))
 
 
 
  
 
 
;去掉了 TODO
 
(setq org-todo-keywords '((sequence  "DOING" "DONE")))
 
(setq org-todo-keyword-faces '(("DOING" . "red")("DONE" . "green")))
 
 
 
 
 
</pre>
 
 
=基本语法=
 
除了 headline 外,Org mode 还支持列表、文字修饰(粗体、斜体、下划线等)、代码块、引用等常见的功能
 
 
[http://www.zmonster.me/2015/07/12/org-mode-introduction.html 强大的Org mode(1):简单介绍与基本使用]
 
 
==基本的任务管理==
 
 
<pre>
 
<pre>
快捷键         功能                                               备注
+
The setup command loads the Kibana dashboards. If the dashboards are already set up, omit this command.
C-c C-t       按照 无状态->TODO->DONE->无状态 的顺序更改任务状态 org-todo
 
Shift-<right> 同上
 
Shift-<left> 按照与 Shift-<right> 相反的顺序更改任务状态
 
</pre>
 
 
 
[http://www.zmonster.me/2015/07/15/org-mode-planning.html 强大的Org mode(2):任务管理]
 
  
== 标题编辑==
+
sudo filebeat setup
<pre>
+
sudo service filebeat start
M-S-LEFT/RIGHT 升级/降级标题树,即标题树内的各级标题相应升/降级
 
 
</pre>
 
</pre>
  
https://blog.csdn.net/u014801157/article/details/24372485
+
== Module status==
 
 
== org 图片==
 
 
<pre>
 
<pre>
 
+
Module status 右边的 check data 按键 -- > Nginx logs dashboard
相对路径方便些
 
file:~/lx/emimg/gen.png
 
 
 
[file://home/evan/wallpaper/f.jpg]
 
填写地址时 要先写 [[    最后再 ]] 不过显示时就没了 ,还有 记得有快捷 键 有空找找 ctrl+l 什么来着
 
 
 
 
 
 
 
C-c C-x C v  快捷键
 
 
 
国 外强大的表达
 
an image without description
 
[[file:/tmp/image.png]]
 
 
 
an image with description
 
[[file:/tmp/image.png][my description]]
 
 
 
emacs gui  
 
 
 
alt+x  org-toggle-inline-images  回车就显示了  ,cli  下好像是不显示的  要images 什么的支持吧
 
不过一般不用命令而是用快快捷 键
 
 
 
 
 
显示图片 快键
 
You can run the command ‘org-toggle-inline-images’ with C-c C-x C-v
 
152 images displayed inline
 
 
 
中文表达如下
 
使用如下标签插入图片,使用C-c C-x C-v inline方式显示图片,或者使用C-c C-o打开链接。
 
[[file:a.png]]
 
 
 
#添加到 .emacs ; iimage-mode 听说现在是内置的了  不用什么 iimage.el了
 
;; 显示图片
 
(auto-image-file-mode t)
 
(defun do-org-show-all-inline-images ()
 
  (interactive)
 
  (org-display-inline-images t t))
 
(global-set-key (kbd "C-c C-x C v")
 
                'do-org-show-all-inline-images)
 
  
 
</pre>
 
</pre>
===TODO Capture the image===
+
systemctl daemon-reload
<pre>
 
: ;; screenshot in org-mode
 
: ;; modified by [email protected]
 
: ;; based on [http://praktikanten.brueckenschlaeger.org/2010/11/28/screenshots-in-org-mode]
 
: (defun my-screenshot ()
 
: "Take a screenshot into a unique-named file in the current buffer file
 
: directory and insert a link to this file."
 
: (interactive)
 
: (setq filename
 
: (concat (make-temp-name
 
: (concat (file-name-directory (buffer-file-name)) "images/" ) ) ".png"))
 
: (if (file-accessible-directory-p (concat (file-name-directory
 
(buffer-file-name)) "images/"))
 
: nil
 
: (make-directory "images"))
 
: (call-process-shell-command "scrot" nil nil nil nil "-s" (concat
 
"\"" filename "\"" ))
 
: (insert (concat "[[" filename "]]"))
 
: (org-display-inline-images)
 
: )
 
:
 
: (global-set-key (kbd "s-s") 'my-screenshot)
 
 
 
 
 
使用说明
 
按win-s键,然后用鼠标划要截屏的范围。这一部分会保存在当前org文件的目录下的images目录下,文件名随机。如果该目录不存在,会自动建立。
 
 
 
依赖; scrot 0.8-11 command line screen capture utility
 
 
 
</pre>
 
=== 图片进阶===
 
 
 
[https://wiki.dreamrunner.org/public_html/Emacs/org-mode.html org-mode and Worg]
 
 
 
 
 
[https://www.cnblogs.com/tigertnt/archive/2013/04/28/3050117.html 截屏并插入图片]
 
 
 
[https://stackoverflow.com/questions/9780124/insert-image-into-text-buffer insert image into text buffer]
 
 
 
[https://www.cnblogs.com/yangwen0228/p/6287455.html 使用Emacs中的org-mode写cnblogs之图片插]
 
 
 
==插入源代码==
 
<pre>
 
 
 
手工插入代码块  只有 shell  标识符 为sh 其它常见都一样
 
 
 
#+BEGIN_SRC sh
 
youshell
 
#+END_SRC
 
 
 
org-mode除了可以直接插入源代码之外,可以直接求出运行结果,这也是其强大之处,在使用之前,需要在.emacs配置文件中设置加载的运行语言:
 
 
 
(org-babel-do-load-languages
 
'org-babel-load-languages
 
'(
 
  (sh . t)
 
  (python . t)
 
  (R . t)
 
  (ruby . t)
 
  (ditaa . t)
 
  (dot . t)
 
  (octave . t)
 
  (sqlite . t)
 
  (perl . t)
 
  (C . t)
 
  ))
 
 
 
设置好之后输入:
 
# +BEGIN_SRC emacs-lisp
 
(+ 1 2 3 4)
 
# +END_SRC
 
 
 
将光标移到代码块内,按C-c C-c,org-mode会自动添加如下一行:
 
 
 
# +RESULTS:
 
: 10
 
 
 
这正是该代码的计算结果。下面试一试Python代码:
 
 
 
# +BEGIN_SRC python :results output
 
a = 1+1
 
print a
 
# +END_SRC
 
 
 
# +RESULTS:
 
: 2
 
 
 
下面测试一下C语言
 
 
 
# +begin_src C++ :includes <stdio.h>
 
  int a=1;
 
  int b=1;
 
  printf("%d\n", a+b);
 
# +end_src
 
 
 
# +RESULTS:
 
: 2
 
 
 
常用快捷键: - C-c C-c 对当前代码块求值
 
 
 
</pre>
 
 
 
[http://wenshanren.org/?p=327 Emacs:在 org-mode 中插入源代码块]
 
 
 
=see aslo=
 
 
 
[https://blog.csdn.net/u014801157/article/details/24372485 Emacs月月积累(终结篇):熟练使用org-mode管理日常事务]
 
 
 
[https://changelog.complete.org/archives/tag/emacs2018 Emacs #5: Documents and Presentations with org-mode]
 
 
 
[http://fuzihao.org/blog/2015/02/19/org-mode%E6%95%99%E7%A8%8B/ org-mode入门教程 ]
 
 
 
[https://i.linuxtoy.org/docs/guide/ch32s03.html#id3155525 第 32 章 组织你的意念:Emacs org mode]
 
 
 
[http://www.zmonster.me/2015/07/12/org-mode-introduction.html 强大的Org mode(1):简单介绍与基本使用]
 
 
 
[https://i.linuxtoy.org/docs/guide/ch32s03.html#id3155525 Emacs org mode]
 
 
 
[https://www.cnblogs.com/qlwy/archive/2012/06/15/2551034.html#sec-1 神器中的神器org-mode之入门篇]
 
 
 
[http://www.cnblogs.com/Open_Source/archive/2011/07/17/2108747.html Org-mode 简明手册]
 
 
 
[http://www.cnblogs.com/holbrook/archive/2012/04/12/2444992.html org-mode: 最好的文档编辑利器,没有之一]
 
 
 
[https://www.jianshu.com/p/32501603970d 用1天快速上手org-mode]
 
 
 
[https://emacs-china.org/t/org-mode/204 如何使用 Org-mode 来计划一天的工作]
 
 
 
[http://fuzihao.org/blog/2015/02/19/org-mode%E6%95%99%E7%A8%8B/ org-mode入门教程]
 
 
 
[http://www.cnblogs.com/holbrook/archive/2012/04/14/2447754.html Org-mode,最强的任务管理利器,没有之一]
 
 
 
 
 
[https://phower.me/project/500/460731605/ 使用Org-Mode&Git-Hook自动部署Wiki]
 
 
 
https://ox-hugo.scripter.co/
 
 
 
 
 
[http://www.cnblogs.com/holbrook/archive/2012/04/17/2454619.html 用Org-mode实现GTD]
 
 
 
[https://blog.csdn.net/u011729865/article/details/54236547 spacemacs org-mode配置GTD]
 
 
 
[https://emacs-china.org/t/topic/5013/10 一个实际可用的 org-mode 轻度GTD 方案]
 
 
 
 
 
[https://linux.cn/article-10340-1.html Emacs 系列(五):Org 模式之文档与演示稿 ]
 
 
 
  
[http://smallzhan.github.io/emacs/2018/05/30/p-org-mode-orgbabel.html Org mode 和 Org-babel 的那些事(二)]
+
=see also=
  
[https://zh.wikipedia.org/wiki/Org-%E6%A8%A1%E5%BC%8F org-mode meawiki]
+
https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-nginx.html
  
[https://www.zhihu.com/question/19851600/answer/17893051 Org-mode、reST、 Markdown 各有什么优缺点]
 
  
[[category:emacs]]
+
[https://www.cnblogs.com/kuku0223/p/8317965.html ELK--filebeat nginx模块]

2021年4月27日 (二) 09:25的版本


ins and config

Download and install Filebeat



curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.12.0-amd64.deb
sudo dpkg -i filebeat-7.12.0-amd64.deb

Edit the configuration

Modify /etc/filebeat/filebeat.yml to set the connection information:

output.elasticsearch:
  hosts: ["<es_url>"]
  username: "elastic"
  password: "<password>"
setup.kibana:
  host: "<kibana_url>"

Where <password> is the password of the elastic user, <es_url> is the URL of Elasticsearch, and <kibana_url> is the URL of Kibana.

Enable and configure the nginx module

sudo filebeat modules enable nginx

Modify the settings in the /etc/filebeat/modules.d/nginx.yml file.

Start Filebeat

The setup command loads the Kibana dashboards. If the dashboards are already set up, omit this command.

sudo filebeat setup
sudo service filebeat start

Module status

Module status  右边的 check data 按键  -- > Nginx logs dashboard

systemctl daemon-reload

see also

https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-nginx.html


ELK--filebeat nginx模块