我正在尝试解析 Logstash 中的 XML 文件。我想使用 XPath 来解析 XML 中的文档。所以当我运行我的配置文件时,数据加载到elasticsearch但它不是我想要加载数据的方式。加载进来的数据elasticsearch是xml文档中的每一行
我的 XML 文件的结构
我想要达到的目标:
在弹性搜索中创建存储以下内容的字段
ID =1
Name = "Finch"
Run Code Online (Sandbox Code Playgroud)
我的配置文件:
input{
file{
path => "C:\Users\186181152\Downloads\stations.xml"
start_position => "beginning"
sincedb_path => "/dev/null"
exclude => "*.gz"
type => "xml"
}
}
filter{
xml{
source => "message"
store_xml => false
target => "stations"
xpath => [
"/stations/station/id/text()", "station_id",
"/stations/station/name/text()", "station_name"
]
}
}
output{
elasticsearch{
codec => json
hosts => "localhost"
index => "xmlns"
}
stdout{
codec => rubydebug …Run Code Online (Sandbox Code Playgroud) 是否可以在已使用的端口上侦听(而不是创建新连接)TCP 数据包,即将数据从路由器发送到服务器。
我知道以下内容启动了上述端口上的侦听过程,并将其保存在文件中pcap:
服务器端:nc -l -p <port> > file_name.pcap
客户端:sudo tcpdump -s 0 -U -n -i eth0 not host <server_ip> -w file_name.pcap | nc <server_ip> <port>
但这会在给定端口上创建一个新连接并捕获与其相关的数据包。我想捕获已用于发送数据包的端口上的数据包。
#include<stdio.h>
#define PRINT(A,B) printf("Value of expression %s is %*",#A,#B,(A))
int main(void){
PRINT(1+3+1,%d);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如何编写一个宏它得到两个参数:expression和format specifier然后打印在给定的格式它的表达和价值?
面对面试时,我感到很困惑
- if({})console.log("hello")
- if([])console.log("hello")
- if('')console.log("hello")
- if('')console.log("hello")
我知道前三个会打印你好,但我不知道评估的基础是什么.
甚至我想知道几个网站或网址,我可以从中获得这些棘手的问题和解决方案
对于我的班级,我遇到了一个问题,我必须创建一个名为Fan的类.然后我被告知要分配不同的字段,其中一个是一个调用的布尔值,如果真的意味着风扇打开了.最后被告知这一点
一个名为的方法toString(),返回风扇的字符串描述.如果风扇打开,则该方法返回一个组合字符串中的风扇速度,颜色和半径.如果风扇未打开,则该方法将返回扇形颜色和半径以及一个组合字符串中的"扇形关闭"字符串.编写一个创建两个Fan对象的Demo类.为第一个风扇分配以下值:speed:1000rpm,radius:12,color:blue和fan-state:on.将以下值分配给第二个风扇:速度:2000rpm,半径:5,颜色:蓝色和扇形状态:关闭.通过调用toString方法显示对象.
所以我继续上课,
包p2 ;
public class Demo {
public static void main(String[] args) {
Fan f1 = new Fan(1000, true, 12, "blue");
Fan f2 = new Fan(2000, false, 5, "blue");
// 1000rpm, radius: 12, color: blue, and fan-state: on
//speed: 2000rpm, radius: 5, color: blue, and fan-state: off
System.out.println(f1);
System.out.println("----------------------------");
System.out.println(f2);
}
}
Run Code Online (Sandbox Code Playgroud)
包p2 ;
public class Fan {
private int speed;
private boolean on;
private double radius;
private String color;
public Fan()
{
speed = 0; …Run Code Online (Sandbox Code Playgroud) if-statement ×2
c ×1
java ×1
javascript ×1
logstash ×1
macros ×1
netcat ×1
pcap ×1
tcpdump ×1
tostring ×1