前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Install Logstash

Install Logstash

作者头像
franket
发布于 2021-08-11 09:27:58
发布于 2021-08-11 09:27:58
46500
代码可运行
举报
文章被收录于专栏:技术杂记技术杂记
运行总次数:0
代码可运行

前言

Logstash 是一个开源的数据收集加工和传输管道

Logstash is an open source data collection engine with real-time pipelining capabilities

具有强大灵活的数据收集处理能力,并且可以几乎实时地传送给后端数据存储引擎,常与 Elasticsearch 和 Kibana 一起组成 ELK 技术栈,给日志分析带来极大的便利

这里分享一下 Logstash 的安装方法

参考 Installing Logstash

Tip: 当前版本 Version:6.1.3


操作

系统环境

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@much ~]# hostnamectl
   Static hostname: much
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 33dc28f7e76c4903ad9b603b77e29a7c
           Boot ID: 71a5a14bde634bfc8c5bafb7d9442f9e
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.21.1.el7.x86_64
      Architecture: x86-64
[root@much ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:d1:5d:f7 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 85051sec preferred_lft 85051sec
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:47:20:56 brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.208/24 brd 192.168.56.255 scope global enp0s8
       valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 52:54:00:16:5e:11 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
    link/ether 52:54:00:16:5e:11 brd ff:ff:ff:ff:ff:ff
[root@much ~]#

导入 GPG key

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@much ~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
[root@much ~]#

配置 repo

配置 logstash 仓库

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@much ~]# vim /etc/yum.repos.d/logstash.repo
[root@much ~]# cat /etc/yum.repos.d/logstash.repo
[logstash-6.x]
name=Elastic repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
[root@much ~]#

Tips: 也可以在这里直接下载 Download Logstash

安装软件

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@much ~]# yum install logstash
Loaded plugins: fastestmirror, langpacks
base                                                     | 3.6 kB     00:00     
c7-media                                                 | 3.6 kB     00:00     
epel/x86_64/metalink                                     | 8.0 kB     00:00     
epel                                                     | 4.7 kB     00:00     
extras                                                   | 3.4 kB     00:00     
jenkins                                                  | 2.9 kB     00:00     
kibana-6.x                                               | 1.3 kB     00:00     
logstash-6.x                                             | 1.3 kB     00:00     
updates                                                  | 3.4 kB     00:00     
(1/4): logstash-6.x/primary                                |  31 kB   00:05     
(2/4): epel/x86_64/updateinfo                              | 880 kB   00:15     
(3/4): epel/x86_64/primary_db                              | 6.2 MB   00:34     
(4/4): updates/7/x86_64/primary_db                         | 6.0 MB   00:41     
Loading mirror speeds from cached hostfile
 * base: mirror.pregi.net
 * c7-media:
 * epel: mirror.pregi.net
 * extras: mirror.pregi.net
 * updates: mirror.pregi.net
logstash-6.x                                                              90/90
Resolving Dependencies
--> Running transaction check
---> Package logstash.noarch 1:6.1.3-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch            Version            Repository           Size
================================================================================
Installing:
 logstash          noarch          1:6.1.3-1          kibana-6.x          114 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 114 M
Installed size: 203 M
Is this ok [y/d/N]: y
Downloading packages:
logstash-6.1.3.rpm                                         | 114 MB   46:52     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:logstash-6.1.3-1.noarch                                    1/1
Using provided startup.options file: /etc/logstash/startup.options
Successfully created system startup script for Logstash
  Verifying  : 1:logstash-6.1.3-1.noarch                                    1/1

Installed:
  logstash.noarch 1:6.1.3-1                                                     

Complete!
[root@much ~]#

查看帮助

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@much ~]# /usr/share/logstash/bin/logstash -h
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Usage:
    bin/logstash [OPTIONS]

Options:
    -n, --node.name NAME          Specify the name of this logstash instance, if no value is given
                                  it will default to the current hostname.
                                   (default: "much")
    -f, --path.config CONFIG_PATH Load the logstash config from a specific file
                                  or directory.  If a directory is given, all
                                  files in that directory will be concatenated
                                  in lexicographical order and then parsed as a
                                  single config file. You can also specify
                                  wildcards (globs) and any matched files will
                                  be loaded in the order described above.
    -e, --config.string CONFIG_STRING Use the given string as the configuration
                                  data. Same syntax as the config file. If no
                                  input is specified, then the following is
                                  used as the default input:
                                  "input { stdin { type => stdin } }"
                                  and if no output is specified, then the
                                  following is used as the default output:
                                  "output { stdout { codec => rubydebug } }"
                                  If you wish to use both defaults, please use
                                  the empty string for the '-e' flag.
                                   (default: nil)
    --modules MODULES             Load Logstash modules.
                                  Modules can be defined using multiple instances
                                  '--modules module1 --modules module2',
                                     or comma-separated syntax
                                  '--modules=module1,module2'
                                  Cannot be used in conjunction with '-e' or '-f'
                                  Use of '--modules' will override modules declared
                                  in the 'logstash.yml' file.
    -M, --modules.variable MODULES_VARIABLE Load variables for module template.
                                  Multiple instances of '-M' or
                                  '--modules.variable' are supported.
                                  Ignored if '--modules' flag is not used.
                                  Should be in the format of
                                  '-M "MODULE_NAME.var.PLUGIN_TYPE.PLUGIN_NAME.VARIABLE_NAME=VALUE"'
                                  as in
                                  '-M "example.var.filter.mutate.fieldname=fieldvalue"'
    --setup                       Load index template into Elasticsearch, and saved searches,
                                  index-pattern, visualizations, and dashboards into Kibana when
                                  running modules.
                                   (default: false)
    --cloud.id CLOUD_ID           Sets the elasticsearch and kibana host settings for
                                  module connections in Elastic Cloud.
                                  Your Elastic Cloud User interface or the Cloud support
                                  team should provide this.
                                  Add an optional label prefix '<label>:' to help you
                                  identify multiple cloud.ids.
                                  e.g. 'staging:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRub3RhcmVhbCRpZGVudGlmaWVy'
    --cloud.auth CLOUD_AUTH       Sets the elasticsearch and kibana username and password
                                  for module connections in Elastic Cloud
                                  e.g. 'username:<password>'
    -w, --pipeline.workers COUNT  Sets the number of pipeline workers to run.
                                   (default: 2)
    --experimental-java-execution (Experimental) Use new Java execution engine.
                                   (default: false)
    -b, --pipeline.batch.size SIZE Size of batches the pipeline is to work in.
                                   (default: 125)
    -u, --pipeline.batch.delay DELAY_IN_MS When creating pipeline batches, how long to wait while polling
                                  for the next event.
                                   (default: 5)
    --pipeline.unsafe_shutdown    Force logstash to exit during shutdown even
                                  if there are still inflight events in memory.
                                  By default, logstash will refuse to quit until all
                                  received events have been pushed to the outputs.
                                   (default: false)
    --path.data PATH              This should point to a writable directory. Logstash
                                  will use this directory whenever it needs to store
                                  data. Plugins will also have access to this path.
                                   (default: "/usr/share/logstash/data")
    -p, --path.plugins PATH       A path of where to find plugins. This flag
                                  can be given multiple times to include
                                  multiple paths. Plugins are expected to be
                                  in a specific directory hierarchy:
                                  'PATH/logstash/TYPE/NAME.rb' where TYPE is
                                  'inputs' 'filters', 'outputs' or 'codecs'
                                  and NAME is the name of the plugin.
                                   (default: [])
    -l, --path.logs PATH          Write logstash internal logs to the given
                                  file. Without this flag, logstash will emit
                                  logs to standard output.
                                   (default: "/usr/share/logstash/logs")
    --log.level LEVEL             Set the log level for logstash. Possible values are:
                                    - fatal
                                    - error
                                    - warn
                                    - info
                                    - debug
                                    - trace
                                   (default: "info")
    --config.debug                Print the compiled config ruby code out as a debug log (you must also have --log.level=debug enabled).
                                  WARNING: This will include any 'password' options passed to plugin configs as plaintext, and may result
                                  in plaintext passwords appearing in your logs!
                                   (default: false)
    -i, --interactive SHELL       Drop to shell instead of running as normal.
                                  Valid shells are "irb" and "pry"
    -V, --version                 Emit the version of logstash and its friends,
                                  then exit.
    -t, --config.test_and_exit    Check configuration for valid syntax and then exit.
                                   (default: false)
    -r, --config.reload.automatic Monitor configuration changes and reload
                                  whenever it is changed.
                                  NOTE: use SIGHUP to manually reload the config
                                   (default: false)
    --config.reload.interval RELOAD_INTERVAL How frequently to poll the configuration location
                                  for changes, in seconds.
                                   (default: 3000000000)
    --http.host HTTP_HOST         Web API binding host (default: "127.0.0.1")
    --http.port HTTP_PORT         Web API http port (default: 9600..9700)
    --log.format FORMAT           Specify if Logstash should write its own logs in JSON form (one
                                  event per line) or in plain text (using Ruby's Object#inspect)
                                   (default: "plain")
    --path.settings SETTINGS_DIR  Directory containing logstash.yml file. This can also be
                                  set through the LS_SETTINGS_DIR environment variable.
                                   (default: "/usr/share/logstash/config")
    --verbose                     Set the log level to info.
                                  DEPRECATED: use --log.level=info instead.
    --debug                       Set the log level to debug.
                                  DEPRECATED: use --log.level=debug instead.
    --quiet                       Set the log level to info.
                                  DEPRECATED: use --log.level=quiet instead.
    -h, --help                    print help
[root@much ~]#

输出输入

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
[root@much ~]# /usr/share/logstash/bin/logstash -e 'input { stdin { } } output { stdout {} }'
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console
The stdin plugin is now waiting for input:
just for test
2018-02-02T13:52:32.823Z much just for test
hello world
2018-02-02T13:52:36.364Z much hello world
abc test
2018-02-02T13:52:38.933Z much abc test

2018-02-02T13:52:41.270Z much

2018-02-02T13:52:41.461Z much

2018-02-02T13:52:41.657Z much

2018-02-02T13:52:41.819Z much

2018-02-02T13:52:41.988Z much
[root@much ~]#

这个简单的实例,是把输入的内容直接打印输出到终端


总结

使用 rpm 包安装的过程非常简单

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
暂无评论
推荐阅读
数据可视化|用Python实现手机抓包,获取当当图书差评数据!
本次学习了手机抓包的相关知识,了解了Charles-mitmproxy-Appium的基本使用,通过对当当图书评论的爬取,得以实践。
龙哥
2019/07/30
1.1K0
数据可视化|用Python实现手机抓包,获取当当图书差评数据!
Appium Desktop 使用
Appium Desktop 元素定位 与Android的uiautomatorviewer一样,可进行元素定位,某些app 在 uiautomatorviewer中获取不到元素,小编这里就遇到获取某个页面元素时,一直报错,使用AppiumDesktop完美解决,AppiumDesktop也可以定位iOS的APP,以下示例都在Android中演示。 录制脚本 支持多种语言,语言可自己选择,目前这个功能只做学习的工具,不能够作为代码生成器(In sum, it is a learning tool, not
企鹅号小编
2018/01/16
1.6K0
Appium Desktop 使用
Appium+Python实现自动化登录
#Appium+Python实现自动化测试 Appium简介 官方的概述为: Appium is an open source test automation framework for use with native, hybrid and mobile web apps. It drives iOS, Android, and Windows apps using the WebDriver protocol. Appium是一个开源的测试自动化框架,用于本地、混合和移动Web应用程序。 它使
py3study
2020/01/07
1.9K0
用Python全自动下载抖音视频!
「用Python在抖音扒了这些高颜值女神后,突然成了人生赢家」,文中简述了一名工程师利用Python+ADB+鹅厂的AI,一晚上关注了一千多个漂亮小姐姐。
小F
2020/10/09
1.4K0
用Python全自动下载抖音视频!
XPath定位如何在App自动化测试中大显神威
和selenium类似,作为App自动化测试的主流框架,appium也是以webdriver为基础来自动化操作App的,所以对于元素定位,其实appium与selenium也是类似的,只是appium还有自己的安卓原生定位方式等方法,但是关于ID定位,name定位,xpath定位等,appium也是支持的,本篇文章就来给大家介绍一下xpath定位是如何在appium中大显神威的。
霍格沃兹测试开发Muller老师
2024/03/26
2630
「docker实战篇」python的docker-打造多任务端app应用数据抓取系统(上)(34)
1.抓取抖音当前视频的作者数据 2.抓取快手当前视频的作者数据 3.抓取今日头条推荐板块新闻
IT架构圈
2019/05/07
1.1K0
「docker实战篇」python的docker-打造多任务端app应用数据抓取系统(上)(34)
Python实现全自动下载抖音视频
这篇文章主要介绍了基于Python实现全自动下载抖音视频,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
python学习教程
2020/11/10
1.2K0
Python实现全自动下载抖音视频
appium+python自动化58-xpath定位
3.class属性唯一的话,可以通过class属性定位到,定位class属性有两种方法
上海-悠悠
2018/07/25
1.5K0
appium+python自动化58-xpath定位
【Appium 自动化测试】搭建 Appium 环境踩坑记录
Python 在自动化测试方面也是非常好用的语言,平时我的工作中也会使用 Python 进行自动化测试的工作,包括接口测试,直接使用 requests 库调用接口就行,跟写爬虫一样;还有云服务的 UI 测试,也就是页面的测试,可以使用 selenium 进行,我经常使用 selenium 写爬虫,所以使用起来也是非常顺手;而进行手机 app 的测试,也有相关工具,现在最流行的就是 appium 了,结合 Python 的连接库,就可以进行手机 app 的自动化测试了。
Hopetree
2022/09/26
1.1K0
【Appium 自动化测试】搭建 Appium 环境踩坑记录
史上最全 Appium 自动化测试从入门到框架实战精华学习笔记(三)
本系列文章汇总了从 Appium 自动化测试从基础到框架高级实战中,所涉及到的方方面面的知识点精华内容(如下所示),希望对大家快速总结和复习有所帮助。
霍格沃兹测试开发
2022/05/30
1.2K0
只会用Selenium爬网页?Appium爬App了解一下
Appium是一个跨平台移动端自动化测试工具,可以非常便捷地为iOS和Android平台创建自动化测试用例。它可以模拟App内部的各种操作,如点击、滑动、文本输入等,只要我们手工操作的动作Appium都可以完成。在前面我们了解过Selenium,它是一个网页端的自动化测试工具。Appium实际上继承了Selenium,Appium也是利用WebDriver来实现App的自动化测试。对iOS设备来说,Appium使用UIAutomation来实现驱动。对于Android来说,它使用UiAutomator和S
崔庆才
2018/06/25
9.6K1
「docker实战篇」python的docker-打造多任务端app应用数据抓取系统(下)(35)
PS:电脑配置比较高i7的cpu,16g的内存,固态的硬盘,尽量还是用真机,如果是真机8g跑的也很666,企业里面还是用真实的手机来跑的。这里综合实战了,从appium的使用,移动端的使用,mitmdump的使用,都综合到了一起。遇到问题其实百度和谷歌都有类似的问题,文章很多部分都是参考:https://github.com/appium/appium-docker-android ,哈哈国内最大的男性交友网站很给力的。
IT架构圈
2019/05/10
1.1K0
「docker实战篇」python的docker-打造多任务端app应用数据抓取系统(下)(35)
基于python的appium例子
版权声明:如需转载本文章,请保留出处! https://blog.csdn.net/xc_zhou/article/details/89643551
周小董
2019/05/10
2.2K0
基于python的appium例子
Appium+python自动化(十)- 元素定位秘籍助你打通任督二脉 - 上卷(超详解)
  你有道灵光从天灵盖喷出来你知道吗,年纪轻轻就有一身横练的筋骨,简直百年一见的练武奇才啊,如果有一天让你打通任督二脉,那还不飞龙上天啊。正所谓我不入地狱谁入地狱,警恶惩奸维护世界和平这个任务就交个你了,好吗。这本如来神掌秘籍是无价之宝,我看与你有缘,收你十块钱传授给你吧。想必这段经典台词给为都可以的耳熟能详吧,宏哥,没这么牛叉呼啦带闪电,就是希望对你有帮助就可以了。
北京-宏哥
2019/07/08
1.8K0
终极利器!利用appium和mitmproxy登录获取cookies
本文章作者陈哥是高级爬虫师哦~他的微信群活跃都很高,光是看看就能学习到很多新的有用的知识。如果你想往爬虫这个方向前进,可以加陈哥的微信号:italocxa
佛系编程人
2019/08/14
2.4K0
Appium之获取app信息及界面定位方法
在使用android自动化测试工具monkeyrunner和appium中启动应用时,需要填写被测程序的包名和启动的Activity,以下有几种查看应用包名package和入口activity名称的方法:
用户6367961
2019/09/30
3.5K0
python appium笔记(二):元素定位
#这里的示例是用android来说明的,xpath应该是通用的,resource-id不太清楚,没配过IOS的环境
free赖权华
2018/08/02
1.6K0
python appium笔记(二):元素定位
appium+python自动化59-多台设备并行
做android自动化的时候,启动一个appium服务,只能匹配一个手机去自动化执行。有时候想同一套代码,可以在不同的手机上执行,测下app在不同手机上兼容性。 这就需要启动多个appium服务了,并且android设备和appium要一一对应才行。
上海-悠悠
2018/07/25
6K1
appium+python自动化59-多台设备并行
App自动化测试|原生app元素定位方法
通过appium inspector工具,可以获取元素的相关信息;在appium中提供了一系列的元素定位API,通过在这些API中输入指定的元素信息,就能完成元素定位,定位元素后就进行对元素进行自动操作。
霍格沃兹测试开发Muller老师
2023/01/31
9760
APP爬虫--appium提取数据
在window的虚拟环境下执行pip install appium-python-client
北山啦
2022/11/27
1.4K0
APP爬虫--appium提取数据
推荐阅读
相关推荐
数据可视化|用Python实现手机抓包,获取当当图书差评数据!
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档