当前位置: 首页 > news >正文

最近在搭建ELK日志平台时,logstash报错JSON parse error

直接进入正题,我在搭建elk日志,使用最简单的log4j2 socket json格式 输出到logstash.

但是logstash报错如下:

[WARN ] 2023-08-30 10:15:17.766 [nioEventLoopGroup-2-2] jsonlines - JSON parse error, original data now in message field {:message=>“incompatible json object type=java.lang.String , only hash map or arrays are supported”, :exception=>LogStash::Json::ParserError, :data=>" “message” : “Started FasterUserApplication in 1.472 seconds (JVM running for 2.232)”,\r"}

总是提示json格式有问题:
logstash配置如图:

input {tcp {port => 4560codec => json_lines}
}
output {elasticsearch {hosts => ["https://192.168.245.140:9200"]index => "applog-%{+YYYY.MM.dd}"template_name => "applog"user => "applog"password => "applog"cacert => "/usr/local/service/elasticsearch-8.9.1/config/certs/http_ca.crt"}file {path => "/usr/local/service/test.log"}
}

log4j2最开始配置如下,下称为配置1:

 <Socket name="socket" host="192.168.245.140" port="4560" protocol="TCP" ><JsonLayout properties="true" ><KeyValuePair key="project" value="demo1"></KeyValuePair></JsonLayout></Socket>

以上配置,每次有日志时,logstash就抛出json解析错误。

[WARN ] 2023-08-30 10:15:17.766 [nioEventLoopGroup-2-2] jsonlines - JSON parse error, original data now in message field {:message=>“incompatible json object type=java.lang.String , only hash map or arrays are supported”, :exception=>LogStash::Json::ParserError, :data=>" “message” : “Started FasterUserApplication in 1.472 seconds (JVM running for 2.232)”,\r"}

后经查证,log4j2修改配置如下,下称为配置2:

<Socket name="socket" host="192.168.245.140" port="4560" protocol="TCP" ><JsonLayout properties="true"  complete="false" compact="true" eventEol="true"locationInfo="false"includeStacktrace="true" stacktraceAsString="true"objectMessageAsJsonObject="true"><KeyValuePair key="project" value="demo1"></KeyValuePair></JsonLayout></Socket>

错误就不再出现了,下面的配置主要是多了json不再美化输出,每条日志记录输出一行json。

以下为对比:
log4j配置1,json日志输出格式为:

"C:\Program Files\Java\jdk-13.0.1\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:10980,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\Miste\.IntelliJIdea2019.3\system\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "D:\workspace\playground\faster-demo\faster-user\target\classes;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter-log4j2\2.5.5\spring-boot-starter-log4j2-2.5.5.jar;D:\workspace\mavenLocalRepository\org\apache\logging\log4j\log4j-slf4j-impl\2.14.1\log4j-slf4j-impl-2.14.1.jar;D:\workspace\mavenLocalRepository\org\slf4j\slf4j-api\1.7.32\slf4j-api-1.7.32.jar;D:\workspace\mavenLocalRepository\org\apache\logging\log4j\log4j-api\2.14.1\log4j-api-2.14.1.jar;D:\workspace\mavenLocalRepository\org\apache\logging\log4j\log4j-core\2.14.1\log4j-core-2.14.1.jar;D:\workspace\mavenLocalRepository\org\apache\logging\log4j\log4j-jul\2.14.1\log4j-jul-2.14.1.jar;D:\workspace\mavenLocalRepository\org\slf4j\jul-to-slf4j\1.7.32\jul-to-slf4j-1.7.32.jar;D:\workspace\mavenLocalRepository\com\lmax\disruptor\3.4.2\disruptor-3.4.2.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter-web\2.5.5\spring-boot-starter-web-2.5.5.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter\2.5.5\spring-boot-starter-2.5.5.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot\2.5.5\spring-boot-2.5.5.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-autoconfigure\2.5.5\spring-boot-autoconfigure-2.5.5.jar;D:\workspace\mavenLocalRepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\workspace\mavenLocalRepository\org\yaml\snakeyaml\1.28\snakeyaml-1.28.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter-json\2.5.5\spring-boot-starter-json-2.5.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\core\jackson-databind\2.12.5\jackson-databind-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\core\jackson-annotations\2.12.5\jackson-annotations-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\core\jackson-core\2.12.5\jackson-core-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.12.5\jackson-datatype-jdk8-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.12.5\jackson-datatype-jsr310-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.12.5\jackson-module-parameter-names-2.12.5.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter-tomcat\2.5.5\spring-boot-starter-tomcat-2.5.5.jar;D:\workspace\mavenLocalRepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.53\tomcat-embed-core-9.0.53.jar;D:\workspace\mavenLocalRepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.53\tomcat-embed-el-9.0.53.jar;D:\workspace\mavenLocalRepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.53\tomcat-embed-websocket-9.0.53.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-web\5.3.10\spring-web-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-beans\5.3.10\spring-beans-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-webmvc\5.3.10\spring-webmvc-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-aop\5.3.10\spring-aop-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-context\5.3.10\spring-context-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-expression\5.3.10\spring-expression-5.3.10.jar;D:\workspace\mavenLocalRepository\mysql\mysql-connector-java\8.0.26\mysql-connector-java-8.0.26.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-core\5.3.10\spring-core-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-jcl\5.3.10\spring-jcl-5.3.10.jar;H:\ProframFiles\IntelliJ IDEA 2019.3\lib\idea_rt.jar" com.github.misterchangray.user.FasterUserApplication
Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Connected to the target VM, address: '127.0.0.1:0', transport: 'socket'
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended.   ____          _            __ _ _/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/  ___)| |_)| | | | | || (_| |  ) ) ) )'  |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot ::                (v2.5.5){"instant" : {"epochSecond" : 1693363254,"nanoOfSecond" : 88010000},"thread" : "main","level" : "INFO","loggerName" : "com.github.misterchangray.user.FasterUserApplication","message" : "Starting FasterUserApplication using Java 13.0.1 on DESKTOP-KVEV94V with PID 13812 (D:\\workspace\\playground\\faster-demo\\faster-user\\target\\classes started by Miste in D:\\workspace\\playground\\faster-demo)","endOfBatch" : false,"loggerFqcn" : "org.apache.commons.logging.LogAdapter$Log4jLog","contextMap" : { },"threadId" : 1,"threadPriority" : 5,"project" : "demo1"
}
{"instant" : {"epochSecond" : 1693363254,"nanoOfSecond" : 167298600},"thread" : "main","level" : "DEBUG","loggerName" : "com.github.misterchangray.user.FasterUserApplication","message" : "Running with Spring Boot v2.5.5, Spring v5.3.10","endOfBatch" : false,"loggerFqcn" : "org.apache.commons.logging.LogAdapter$Log4jLog","contextMap" : { },"threadId" : 1,"threadPriority" : 5,"project" : "demo1"
}
{"instant" : {"epochSecond" : 1693363254,"nanoOfSecond" : 169298100},"thread" : "main","level" : "INFO","loggerName" : "com.github.misterchangray.user.FasterUserApplication","message" : "No active profile set, falling back to default profiles: default","endOfBatch" : false,"loggerFqcn" : "org.apache.commons.logging.LogAdapter$Log4jLog","contextMap" : { },"threadId" : 1,"threadPriority" : 5,"project" : "demo1"
}

配置2日志输出格式为:

"C:\Program Files\Java\jdk-13.0.1\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:8338,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\Miste\.IntelliJIdea2019.3\system\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "D:\workspace\playground\faster-demo\faster-user\target\classes;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter-log4j2\2.5.5\spring-boot-starter-log4j2-2.5.5.jar;D:\workspace\mavenLocalRepository\org\apache\logging\log4j\log4j-slf4j-impl\2.14.1\log4j-slf4j-impl-2.14.1.jar;D:\workspace\mavenLocalRepository\org\slf4j\slf4j-api\1.7.32\slf4j-api-1.7.32.jar;D:\workspace\mavenLocalRepository\org\apache\logging\log4j\log4j-api\2.14.1\log4j-api-2.14.1.jar;D:\workspace\mavenLocalRepository\org\apache\logging\log4j\log4j-core\2.14.1\log4j-core-2.14.1.jar;D:\workspace\mavenLocalRepository\org\apache\logging\log4j\log4j-jul\2.14.1\log4j-jul-2.14.1.jar;D:\workspace\mavenLocalRepository\org\slf4j\jul-to-slf4j\1.7.32\jul-to-slf4j-1.7.32.jar;D:\workspace\mavenLocalRepository\com\lmax\disruptor\3.4.2\disruptor-3.4.2.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter-web\2.5.5\spring-boot-starter-web-2.5.5.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter\2.5.5\spring-boot-starter-2.5.5.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot\2.5.5\spring-boot-2.5.5.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-autoconfigure\2.5.5\spring-boot-autoconfigure-2.5.5.jar;D:\workspace\mavenLocalRepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\workspace\mavenLocalRepository\org\yaml\snakeyaml\1.28\snakeyaml-1.28.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter-json\2.5.5\spring-boot-starter-json-2.5.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\core\jackson-databind\2.12.5\jackson-databind-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\core\jackson-annotations\2.12.5\jackson-annotations-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\core\jackson-core\2.12.5\jackson-core-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.12.5\jackson-datatype-jdk8-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.12.5\jackson-datatype-jsr310-2.12.5.jar;D:\workspace\mavenLocalRepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.12.5\jackson-module-parameter-names-2.12.5.jar;D:\workspace\mavenLocalRepository\org\springframework\boot\spring-boot-starter-tomcat\2.5.5\spring-boot-starter-tomcat-2.5.5.jar;D:\workspace\mavenLocalRepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.53\tomcat-embed-core-9.0.53.jar;D:\workspace\mavenLocalRepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.53\tomcat-embed-el-9.0.53.jar;D:\workspace\mavenLocalRepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.53\tomcat-embed-websocket-9.0.53.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-web\5.3.10\spring-web-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-beans\5.3.10\spring-beans-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-webmvc\5.3.10\spring-webmvc-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-aop\5.3.10\spring-aop-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-context\5.3.10\spring-context-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-expression\5.3.10\spring-expression-5.3.10.jar;D:\workspace\mavenLocalRepository\mysql\mysql-connector-java\8.0.26\mysql-connector-java-8.0.26.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-core\5.3.10\spring-core-5.3.10.jar;D:\workspace\mavenLocalRepository\org\springframework\spring-jcl\5.3.10\spring-jcl-5.3.10.jar;H:\ProframFiles\IntelliJ IDEA 2019.3\lib\idea_rt.jar" com.github.misterchangray.user.FasterUserApplication
Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Connected to the target VM, address: '127.0.0.1:0', transport: 'socket'
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended.   ____          _            __ _ _/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/  ___)| |_)| | | | | || (_| |  ) ) ) )'  |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot ::                (v2.5.5){"instant":{"epochSecond":1693362240,"nanoOfSecond":139475300},"thread":"main","level":"INFO","loggerName":"com.github.misterchangray.user.FasterUserApplication","message":"Starting FasterUserApplication using Java 13.0.1 on DESKTOP-KVEV94V with PID 21844 (D:\\workspace\\playground\\faster-demo\\faster-user\\target\\classes started by Miste in D:\\workspace\\playground\\faster-demo)","endOfBatch":false,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","contextMap":{},"threadId":1,"threadPriority":5,"project":"demo1"}
{"instant":{"epochSecond":1693362240,"nanoOfSecond":202819200},"thread":"main","level":"DEBUG","loggerName":"com.github.misterchangray.user.FasterUserApplication","message":"Running with Spring Boot v2.5.5, Spring v5.3.10","endOfBatch":false,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","contextMap":{},"threadId":1,"threadPriority":5,"project":"demo1"}
{"instant":{"epochSecond":1693362240,"nanoOfSecond":203813500},"thread":"main","level":"INFO","loggerName":"com.github.misterchangray.user.FasterUserApplication","message":"No active profile set, falling back to default profiles: default","endOfBatch":false,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","contextMap":{},"threadId":1,"threadPriority":5,"project":"demo1"}
{"instant":{"epochSecond":1693362240,"nanoOfSecond":734127100},"thread":"main","level":"INFO","loggerName":"org.springframework.boot.web.embedded.tomcat.TomcatWebServer","message":"Tomcat initialized with port(s): 8089 (http)","endOfBatch":false,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","contextMap":{},"threadId":1,"threadPriority":5,"project":"demo1"}
{"instant":{"epochSecond":1693362240,"nanoOfSecond":745097900},"thread":"main","level":"INFO","loggerName":"org.apache.coyote.http11.Http11NioProtocol","message":"Initializing ProtocolHandler [\"http-nio-8089\"]","endOfBatch":false,"loggerFqcn":"java.util.logging.Logger","contextMap":{},"threadId":1,"threadPriority":5,"project":"demo1"}

相关文章:

最近在搭建ELK日志平台时,logstash报错JSON parse error

直接进入正题&#xff0c;我在搭建elk日志&#xff0c;使用最简单的log4j2 socket json格式 输出到logstash. 但是logstash报错如下&#xff1a; [WARN ] 2023-08-30 10:15:17.766 [nioEventLoopGroup-2-2] jsonlines - JSON parse error, original data now in message field…...

某次护网红队getshell的经历

信息收集 某企业提供信息&#xff1a;企业官网的真实外网ip&#xff0c;内网ip 企业官网比较硬&#xff0c;从控股超过51%的子公司入手 通过企查查找到一堆控股高的子公司&#xff0c;通过ICP/IP地址/域名信息备案管理系统查找子公司官网&#xff0c;收集二级域名。通过google…...

C#实现日期选择器、显示当地时间、跑马灯等功能

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System...

如何让看书变听书?

听书神器 安卓 页面简单&#xff0c;易操作&#xff0c;全网小说随便听 各种声音帮你读你喜欢听的小说&#xff0c;带你进入主人公世界 支持网页版小说、本地小说、图片&#xff0c;都能读给你听 想看小说&#xff0c;又怕伤眼睛的宝子&#xff0c;可以试试看&#xff01;…...

pytorch异常——loss异常,不断增大,并且loss出现inf

文章目录 异常报错异常截图异常代码原因解释修正代码执行结果 异常报错 epoch1:loss3667.782471 epoch2:loss65358620.000000 epoch3:loss14979486720.000000 epoch4:loss1739650891776.000000 epoch5:loss12361745880317952.000000 epoch6:loss2740315398365287284736.000000…...

Lua学习(一)

lua基础学习 LUA 语言1. 什么是lua&#xff1f;1.1 准备工作 2. 基本语法2.1 注释2.2 标识符2.3 关键字2.4 全局变量 3. 数据类型4. 变量4.1 赋值语句 5. 循环5.1 while循环5.2 for循环5.3泛型for循环5.4 repeat until 循环5.5 break 语句 6. 流程控制6.1 if语句6.2 if else 语…...

Python:列表推导式

相关阅读 Python专栏https://blog.csdn.net/weixin_45791458/category_12403403.html?spm1001.2014.3001.5482 列表推导式使得创建特定列表的方式更简洁。常见的用法为&#xff0c;对序列或可迭代对象中的每个元素应用某种操作&#xff0c;用生成的结果创建新的列表&#xff…...

应急三维电子沙盘数字孪生系统

一、简介应急三维电子沙盘数字孪生系统是一种基于虚拟现实技术和数字孪生技术的应急管理工具。它通过将真实世界的地理环境与虚拟世界的模拟环境相结合&#xff0c;实现了对应急场景的模拟、分析和决策支持。该系统主要由三维电子沙盘和数字孪生模型两部分组成。三维电子沙盘是…...

LeetCode每日一题:1654. 到家的最少跳跃次数(2023.8.30 C++)

目录 1654. 到家的最少跳跃次数 题目描述&#xff1a; 实现代码与解析&#xff1a; bfs 1654. 到家的最少跳跃次数 题目描述&#xff1a; 有一只跳蚤的家在数轴上的位置 x 处。请你帮助它从位置 0 出发&#xff0c;到达它的家。 跳蚤跳跃的规则如下&#xff1a; 它可以 …...

数据结构例题代码及其讲解-栈与队列

栈与队列 栈Stack 后进先出 ​ 栈的结构体定义及基本操作。 #define MaxSize 50 typedef struct {int data[MaxSize];//栈中存放数据类型为整型int top;//栈顶指针 }Stack;初始化 ​ 这里初始化时是将栈顶指针指向-1&#xff0c;有些则是指向0&#xff0c;因此后续入栈出栈…...

【Spark】Pyspark RDD

1. RDD算子1.1 文件 <> rdd对象1.2 map、foreach、mapPartitions、foreach Partitions1.3 flatMap 先map再解除嵌套1.4 reduceByKey、reduce、fold 分组聚合1.5 mapValue 二元组value进行map操作1.6 groupBy、groupByKey1.7 filter、distinct 过滤筛选1.8 union 合并1.9 …...

数学建模:Logistic回归预测

&#x1f506; 文章首发于我的个人博客&#xff1a;欢迎大佬们来逛逛 数学建模&#xff1a;Logistic回归预测 Logistic回归预测 logistic方程的定义&#xff1a; x t 1 c a e b t x_{t}\frac{1}{cae^{bt}}\quad xt​caebt1​ d x d t − a b e b t ( c a e b t ) 2 >…...

一个面向MCU的小型前后台系统

JxOS简介 JxOS面向MCU的小型前后台系统&#xff0c;提供消息、事件等服务&#xff0c;以及软件定时器&#xff0c;低功耗管理&#xff0c;按键&#xff0c;led等常用功能模块。 gitee仓库地址为&#xff08;复制到浏览器打开&#xff09;&#xff1a; https://gitee.com/jer…...

软件外包开发人员分类

在软件开发中&#xff0c;通常会分为前端开发和后端开发&#xff0c;下面和大家分享软件开发中的前端开发和后端开发分类和各自的职责&#xff0c;希望对大家有所帮助。北京木奇移动技术有限公司&#xff0c;专业的软件外包开发公司&#xff0c;欢迎交流合作。 1. 前端开发&…...

HTML 元素被定义为块级元素或内联元素

大多数 HTML 元素被定义为块级元素或内联元素。 10. 块级元素 块级元素在浏览器显示时&#xff0c;通常会以新行来开始&#xff08;和结束&#xff09;。 我们已经学习过的块级元素有: <h1>, <p>, <ul>, <table> 等。 值得注意的是: <p> 标签…...

单调递增的数字【贪心算法】

单调递增的数字 当且仅当每个相邻位数上的数字 x 和 y 满足 x < y 时&#xff0c;我们称这个整数是单调递增的。 给定一个整数 n &#xff0c;返回 小于或等于 n 的最大数字&#xff0c;且数字呈 单调递增 。 public class Solution {public int monotoneIncreasingDigits…...

gnuradio-hackrf_info.exe -FM频率使用

97910000...

JVM学习(三)--生产环境的线程问题诊断

1.如何定位哪个进程对cpu占用过高 使用top命令 2.如何定位到某个进程的具体某个线程 使用ps H -eo pid,tid,%cpu | grep 进程id (可以具体定位到某个进程的某个线程的cpu占用情况) 3.如何查看有问题线程的具体信息&#xff0c;定位到代码的行数 使用jstack 进程id 可以找…...

PHP数组处理$arr1转换为$arr2

请编写一段程序将$arr1转换为$arr2 $arr1 array( 0>array (fid>1,tid>1,name>Name1), 1>array (fid>2,tid>2,name>Name2), 2>array (fid>3,tid>5,name>Name3), 3>array (fid>4,tid>7,name>Name4), 4>array (fid>5,tid…...

ATF(TF-A)安全通告 TFV-10 (CVE-2022-47630)

安全之安全(security)博客目录导读 ATF(TF-A)安全通告汇总 目录 一、ATF(TF-A)安全通告 TFV-10 (CVE-2022-47630) 二、CVE-2022-47630 2.1 Bug 1:证书校验不足 2.2 Bug 2:auth_nvctr()中缺少边界检查...

详解 SpringMVC 中获取请求参数

文章目录 1、通过ServletAPI获取2、通过控制器方法的形参获取请求参数3、[RequestParam ](/RequestParam )4、[RequestHeader ](/RequestHeader )5、[CookieValue ](/CookieValue )6、通过POJO获取请求参数7、解决获取请求参数的乱码问题总结 在Spring MVC中&#xff0c;获取请…...

Message: ‘chromedriver‘ executable may have wrong permissions.

今天运行项目遇到如下代码 driverwebdriver.Chrome(chrome_driver, chrome_optionsoptions)上述代码运行报错如下&#xff1a; Message: chromedriver executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home出错的原…...

每日一题 1372二叉树中的最长交错路径

题目 给你一棵以 root 为根的二叉树&#xff0c;二叉树中的交错路径定义如下&#xff1a; 选择二叉树中 任意 节点和一个方向&#xff08;左或者右&#xff09;。如果前进方向为右&#xff0c;那么移动到当前节点的的右子节点&#xff0c;否则移动到它的左子节点。改变前进方…...

【力扣每日一题】2023.9.2 最多可以摧毁的敌人城堡数量

目录 题目&#xff1a; 示例&#xff1a; 分析&#xff1a; 代码&#xff1a; 题目&#xff1a; 示例&#xff1a; 分析&#xff1a; 这道题难在阅读理解&#xff0c;题目看得我匪夷所思&#xff0c;错了好多个测试用例才明白题目说的是什么。 我简单翻译一下就是寻找1和…...

kotlin实现java的单例模式

代码 package com.flannery.interviewdemo.singleinstance//https://blog.csdn.net/Jason_Lee155/article/details/128796742 Java实现 //public class SingletonDemo { // private static SingletonDemo instancenew SingletonDemo(); // private SingletonDemo() // …...

使用 KeyValueDiffers 检测Angular 对象的变化

使用 KeyValueDiffers 检测Angular 对象的变化 ngDoCheck钩子 ngDoCheck 是 Angular 生命周期钩子之一。它允许组件在 Angular 检测到变化时执行自定义的变化检测逻辑。 当任何组件或指令的输入属性发生变化、在组件内部发生了变更检测周期或者当主动触发变更检测策略&#…...

Macos 10.13.2安装eclipse

eclipse for php 安装2021-12最后版本4.22 2021-12 R | Eclipse Packages jdk17 x64 dmg安装包,要安装jdk这个才能运行 Java Downloads | Oracle...

Android逆向学习(一)vscode进行android逆向修改并重新打包

Android逆向学习&#xff08;一&#xff09;vscode进行android逆向修改并重新打包 写在前面 其实我不知道这个文章能不能写下去&#xff0c;其实我已经开了很多坑但是都没填上&#xff0c;现在专利也发出去了&#xff0c;就开始填坑了&#xff0c;本坑的主要内容是关于androi…...

【深入浅出设计模式--状态模式】

深入浅出设计模式--状态模式 一、背景二、问题三、解决方案四、 适用场景总结五、后记 一、背景 状态模式是一种行为设计模式&#xff0c;让你能在一个对象的内部状态变化时改变其行为&#xff0c;使其看上去就像改变了自身所属的类一样。其与有限状态机的概念紧密相关&#x…...

Debezium系列之:Debezium Server在生产环境大规模应用详细的技术方案

Debezium系列之:Debezium Server在生产环境大规模应用详细的技术方案 一、需求背景二、Debezium Server实现技术三、技术方案流程四、生成接入配置五、新增数据库接入和删除数据库接入效果六、监控zookeeper节点程序七、新增数据库接入部署debezium server程序八、删除数据库接…...

章丘营销型网站设计公司/完整企业网站模板

目标列表元组字典字符串公共方法变量高级知识点回顾Python 中数据类型可以分为 数字型 和 非数字型数字型整型 (int)浮点型(float)布尔型(bool)真 True 非 0 数 —— 非零即真假 False 0复数型 (complex)主要用于科学计算&#xff0c;例如&#xff1a;平面场问题、波动问题、电…...

深圳做网站设计公司/搜易网提供的技术服务

C语言acm竞赛习题集锦目录数塔问题............................2并查集类问题........................4递推类问题..........................9动态规划系列........................10概率类题型..........................13组合数学类题型......................15贪心策略…...

住房和城乡建设统计网站/长春seo网站排名

中国浙江温州小型皮鞋厂老板&#xff0c;面对皮鞋进水发胖问题&#xff0c;没有任何解决的办法&#xff01; 本周末写点轻松的好玩的事&#xff0c;所谓轻松的好玩的事&#xff0c;那就是既不怕犯错&#xff0c;又不用背锅的事&#xff0c;完全不用负责任&#xff0c;那就说说t…...

wordpress怎么添加音乐播放器/2023年5月疫情爆发

One option is have temp buffer start some known size then increase it if see it’s not enough with vsnprintf. Are there better approach? Thanks您可以使用vasprintf(),但这会进行不必要的堆分配 – 平均来说不太可能更快.使用alloca可以避免堆.或者,您可以直接写入返…...

开了外网网站打不开/百度网址大全下载安装

16/32位基本寄存器##段寄存器的使用指令指针寄存器和标志寄存器标志寄存器(FLAGS):用于存放系统的状态标志和控制标志。状态标志&#xff1a;是CPU在执行指令的过程中产生的。有的指令影响状态标志&#xff0c;有的不影响&#xff0c;还有的指令与当前状态标志有关。标志寄存器…...

做社群的网站有哪些/社交网络推广方法

传送门 咱先膜一下\(GXZ\)再说 我们先把序列从小到大排序&#xff0c;然后分情况讨论 无解是不存在的&#xff0c;从小到大输出所有数肯定可行 情况一&#xff0c;如果\(a[mid]a[mid1]\)&#xff0c;因为最终的中位数也是它们&#xff0c;那么我们可以让中位数一直等于\(a[mid]…...