巨型日志处理系统

ASC vs BLF格式详解:CANoe工程师必备的日志处理指南(含转换工具对比) 本文深入解析了汽车电子开发中两种核心CAN日志格式ASC与BLF的本质差异与应用场景。ASC为纯文本格式,具有极佳的可读性,便于调试;而BLF为二进制格式,体积小、读写速度快,能记录更丰富的总线信息。文章对比了CANoe、Wireshark等主流工具对两者的支持,并提供了实用的Python转换代码,帮助工程师根据测试记录与离线分析的不同阶段,构建高效的日志处理流程。 阅读详情

转载请注明地址

本次模拟系统,是利用Hadoop等组件来模拟巨型日志的处理系统,包括Python定时、Flume收集日志、MR处理日志、Sqoop导出数据、Hive的简单统计等,具体的架构如下:

一、项目架构



二、数据源下载

数据源我也是从csdn上下载的日志数据,想要的可以留下邮箱!


三、Python定时把下载的日志文件从一个文件夹拷贝到Flume能收集到的文件夹中

    【注意:如何搞定时间不同,复制的文件也不同】

from datetime import date, time, datetime, timedelta
import os
def work(i):
	if i>13:
		data_path='/home/hadoop/LogModel/data/ex0412'+str(i)+'.log'
		os.system("sudo cp "+data_path2+" /home/hadoop/LogModel/source/")
	if i<10:
		data_path='/home/hadoop/LogModel/data/ex05010'+str(i)+'.log'
		os.system("sudo cp "+data_path2+" /home/hadoop/LogModel/source/")
	if i>9 or i<14:
		data_path1='/home/hadoop/LogModel/data/ex0412'+str(i)+'.log'
		os.system("sudo cp "+data_path1+" /home/hadoop/LogModel/source/")
		data_path2='/home/hadoop/LogModel/data/ex0501'+str(i)+'.log'
		os.system("sudo cp "+data_path2+" /home/hadoop/LogModel/source/")
def runTask(func, day=0, hour=0, min=0, second=0):
	# Init time
	now = datetime.now()
	strnow = now.strftime('%Y-%m-%d %H:%M:%S')
	print("now:",strnow)
	# First next run time
	period = timedelta(days=day, hours=hour, minutes=min, seconds=second)
	next_time = now + period
	strnext_time = next_time.strftime('%Y-%m-%d %H:%M:%S')
	print("next run:",strnext_time)
	i=12
	while(i<31):
		# Get system current time
		iter_now = datetime.now()
		iter_now_time = iter_now.strftime('%Y-%m-%d %H:%M:%S')
		if str(iter_now_time) == str(strnext_time):
			i=i+1
			# Get every start work time
			print("start work: %s" % iter_now_time)
			# Call task func
			func(i)
			print("task done.")
			# Get next iteration time
			iter_time = iter_now + period
			strnext_time = iter_time.strftime('%Y-%m-%d %H:%M:%S')
			print("next_iter: %s" % strnext_time)
			# Continue next iteration
			continue
runTask(work, min=0.5)
四、利用Flume收集日志
1、日志分布情况:
机子slave1上有个日志文件:/home/hadoop/LogModel/source1
机子slave2上有个日志文件:/home/hadoop/LogModel/source2
2、日志汇总:
机子hadoop上在HDFS中有个日志汇总文件:/LogModel/source
3、具体实现:
对于slave1主机:
#agent1
a1.sources=sc1
a1.sinks=sk1
a1.channels=ch1
#source1
a1.sources.sc1.type=spooldir
a1.sources.sc1.spoolDir=/home/hadoop/LogModel/source1
a1.sources.sc1.channels=ch1
a1.sources.sc1.fileHeader = false
#channel1
a1.channels.ch1.type=file
#a1.channels.ch1.checkpointDir=/home/hadoop/flume/tmp
a1.channels.ch1.dataDirs=/home/hadoop/flume/data_tmp          
#sink1
a1.sinks.sk1.type=avro
a1.sinks.sk1.hostname=hadoop    
a1.sinks.sk1.port=23004        
a1.sinks.sk1.channel=ch1:
对于slave2主机:

#agent2
a2.sources=sc2
a2.sinks=sk2
a2.channels=ch2
#source2
a2.sources.sc2.type=spooldir
a2.sources.sc2.spoolDir=/home/hadoop/LogModel/source2   
a2.sources.sc2.channels=ch2
a2.sources.sc2.fileHeader = false
#channel2
a2.channels.ch2.type=file
#a2.channels.ch2.checkpointDir=/home/hadoop/flume/tmp
a2.channels.ch2.dataDirs=/home/hadoop/flume/data_tmp          
#sink2
a2.sinks.sk2.type=avro
a2.sinks.sk2.hostname=hadoop    
a2.sinks.sk2.port=41414       
a2.sinks.sk2.channel=ch2
日志缓冲主机hadoop中  flume 配置文件重命名为 flume_sink ;

a3.sources=sc1 sc2   
a3.channels=ch1 ch2
a3.sinks=sk1 sk2
a3.sources.sc1.type = avro
a3.sources.sc1.bind=0.0.0.0
a3.sources.sc1.port=23004
a3.sources.sc1.channels=ch1
a3.channels.ch1.type = file
a3.channels.ch1.checkpointDir=/home/hadoop/flume/checkpoint
a3.channels.ch1.dataDirs=/home/hadoop/flume/data
a3.sinks.sk1.type=hdfs
a3.sinks.sk1.channel=ch1
a3.sinks.sk1.hdfs.path=hdfs://hadoop:9000/LogModel/source
a3.sinks.sk1.hdfs.filePrefix=ent-
a3.sinks.sk2.hdfs.fileType=DataStream
a3.sinks.sk2.hdfs.writeFormat=TEXT
a3.sinks.sk1.hdfs.round=true
a3.sinks.sk1.hdfs.roundValue=5
a3.sinks.sk1.hdfs.roundUnit=minute
a3.sinks.sk1.hdfs.rollInterval=30      
a3.sinks.sk1.hdfs.rollSize=0
a3.sinks.sk1.hdfs.rollCount=0

a3.sources.sc2.type = avro
a3.sources.sc2.bind=0.0.0.0
a3.sources.sc2.port=41414                                    
a3.sources.sc2.channels=ch2
a3.channels.ch2.type = file
a3.channels.ch2.checkpointDir=/home/hadoop/flume/checkpoint2  
a3.channels.ch2.dataDirs=/home/hadoop/flume/data2             
a3.sinks.sk2.type=hdfs
a3.sinks.sk2.channel=ch2
a3.sinks.sk2.hdfs.path=hdfs://hadoop:9000/LogModel/source
a3.sinks.sk2.hdfs.fileType=DataStream
a3.sinks.sk2.hdfs.writeFormat=TEXT
a3.sinks.sk2.hdfs.filePrefix=ent-
a3.sinks.sk2.hdfs.round=true
a3.sinks.sk2.hdfs.roundValue=5
a3.sinks.sk2.hdfs.roundUnit=minute
a3.sinks.sk2.hdfs.rollInterval=30      
a3.sinks.sk2.hdfs.rollSize=0
a3.sinks.sk2.hdfs.rollCount=0
【先启动Flume,再启动定时】
在HDFS中得到文件夹:
/LogModel/source/

五、利用java封装日志信息:

1、分析日志格式:每行以空格隔开,包含11段:日期、时间、客户端主机IP、服务器IP、服务器端口、请求、源页面、状态、浏览器和操作系统版本
2004-12-13 00:02:37 219.137.244.90 - 211.66.184.35 80 GET /news/newshtml/schoolNews/20041210171434.asp - 200 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+MyIE2)
2004-12-13 00:00:45 172.16.96.22 - 211.66.184.35 80 GET /all.css - 304 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1)
2004-12-18 23:58:47 172.16.96.14 - 211.66.184.35 80 GET /images/index_r2_c7.jpg - 304 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.0)
2、分析保留主要字段:
日期、时间、客户端主机IP、服务器IP、源页面、状态、浏览器版本、操作系统版本
3、分装日志对象:

public class Log {

	private String date;
	private String time;
	private String client_IP;
	private String server_IP;
	private String orignHtml;
	private String status;
	private String Btype;
	
	//构造函数
	public Log()
	{}
	
	public Log(String log)
	{
		String[]logs=log.split(" ");
		if(logs.length>10)
		{
			if(logs[0].length()>=10)
			{
				this.date=logs[0].substring(logs[0].length()-10);
			}
			this.time=logs[1];
			this.client_IP=logs[2];
			this.server_IP=logs[4];
			this.orignHtml=logs[7];
			this.status=logs[9];
			this.Btype=logs[10];
		}	
	}
	
	//set、get函数
	public String getBtype() {
		return Btype;
	}

	public void setBtype(String btype) {
		Btype = btype;
	}

	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	public String getTime() {
		return time;
	}
	public void setTime(String time) {
		this.time = time;
	}
	public String getClient_IP() {
		return client_IP;
	}
	public void setClient_IP(String client_IP) {
		this.client_IP = client_IP;
	}
	public String getServer_IP() {
		return server_IP;
	}
	public void setServer_IP(String server_IP) {
		this.server_IP = server_IP;
	}
	public String getOrignHtml() {
		return orignHtml;
	}
	public void setOrignHtml(String orignHtml) {
		this.orignHtml = orignHtml;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
}
六、利用MR程序整理成结构化的数据输出到一个文件中
public class LogFormat {

	public static class LogMap extends Mapper<Object, Text, NullWritable, Text>{ 

            public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
	    //获取一行日志
            if(!value.toString().startsWith("#")&&value.toString()!=null&&value.toString().length()>60)
            {
            	Log log=new Log(value.toString());
		//注意如何处理过滤掉不合格的数据
            	if(log.getDate()!=null&&log.getTime()!=null&&!log.getTime().equals("date")&&!log.getTime().equals("time")&&log.getDate().contains("-")&&log.getTime().contains(":"))
            	{
            		//构造格式化日志
        			String val=log.getDate()+"\t"+log.getTime()+"\t"+log.getClient_IP()+"\t"+log.getServer_IP()+"\t"+log.getOrignHtml()+"\t"+log.getStatus()+"\t"+log.getBtype();
        	       //写出
        			
        			context.write(NullWritable.get(),new Text(val));
            	}
            }
		}
	}
 
	public static void main(String[] args) throws Exception {
		Configuration conf = new Configuration();
		String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
		if (otherArgs.length != 2) {
		System.err.println("Usage: LogFormat <in> <out>");
		System.exit(2);
		}
		Job job = Job.getInstance(conf, "LogFormat");
		job.setJarByClass(LogFormat.class);
		job.setMapperClass(LogMap.class);
		job.setOutputKeyClass(NullWritable.class);
		job.setOutputValueClass(Text.class);
		FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
		FileOutputFormat.setOutputPath(job,new Path(otherArgs[1]));
		job.waitForCompletion(true);
		System.out.println("Job is successful?:"+(job.isSuccessful() ? "shi": "no"));
		}
}
七、把数据导入到MySQL中去:
1、MySQL配置:【尤其是远程访问】
MySQL安装在slave1机子上,建立xuchao用户,赋予所有的权限:
A、修改/etc/mysql/my.cnf文件,把bind.adress=127.0.0.1改为 0.0.0.0;
B、grant all privileges on *.* to 'xuchao'@'%' identified by '123456'; FLUSH PRIVILEGES; 
C、重新启动mysql服务:/etc/init.d/mysql start
2、在MySQL中建立一张表:
create table Log(date char(11),time char(9),client_IP char(15),server_IP char(15),orignHtml char(100),status char(4),Btype char(120))
3、利用Sqoop导入数据库

sqoop export --connect jdbc:mysql://slave1:3306/Log --username xuchao --password 123456 --table Log --export-dir /output/part-r-00000 
--input-fields-terminated-by '\t' --input-null-string '\\N' --input-null-non-string '\\N'
八、数据库定时备份

import    os
import    sys
from datetime import date, time, datetime, timedelta
from stat import *
def MySQLBackup():
	User = 'xuchao' 
	Passwd = '123456' 
	Mysqlcommand = '/usr/bin/mysqldump'
	Gzipcommand = '/bin/gzip'
	Mysqldata  = ['Log','Log']
	Tobackup = '/home/hadoop/LogModel/mysqlBackup/'
	for DB in Mysqldata:
		now = datetime.now()
		Backfile = Tobackup + DB + '-' + now.strftime('%H-%M-%S') + '.sql'
		Gzfile = Backfile +'.gz'
		if os.path.isfile(Gzfile):
			print(Gzfile + " is already backup")
		else:
			Back_command = Mysqlcommand + '-h slave1 -u' + User + ' -p' + Passwd + ' -P3306 ' + DB + ' > ' + Backfile
			if os.system(Back_command)==0:
				print('Successful backup to', DB + ' to ' + Backfile)
			else:
				print('Backup FAILED')
			Gzip_command = Gzipcommand + ' ' + Backfile
			if os.system(Gzip_command)==0:
				print('Successful Gzip to',Gzfile)
			else:
				print('Gzip FAILED')
			Scp_command1='scp -r '+Tobackup+' hadoop@hadoop:~/LogModel/'
			Scp_command2='scp -r '+Tobackup+' hadoop@slave2:~/LogModel/'
			if os.system(Scp_command1)==0:
				print('Successful backup to', DB + ' to hadoop')
			else:
				print('Backup To hadoop FAILED')
			if os.system(Scp_command2)==0:
				print('Successful backup to', DB + ' to slave2')
			else:
				print('Backup To slave2 FAILED')

def runTask(func, day=0, hour=0, min=0, second=0):
	# Init time
	now = datetime.now()
	strnow = now.strftime('%Y-%m-%d %H:%M:%S')
	print("now:",strnow)
	# First next run time
	period = timedelta(days=day, hours=hour, minutes=min, seconds=second)
	next_time = now + period
	strnext_time = next_time.strftime('%Y-%m-%d %H:%M:%S')
	print("next run:",strnext_time)
	while True:
		# Get system current time
		iter_now = datetime.now()
		iter_now_time = iter_now.strftime('%Y-%m-%d %H:%M:%S')
		if str(iter_now_time) == str(strnext_time):
			# Get every start work time
			print("start work: %s" % iter_now_time)
			# Call task func
			func()
			print("task done.")
			# Get next iteration time
			iter_time = iter_now + period
			strnext_time = iter_time.strftime('%Y-%m-%d %H:%M:%S')
			print("next_iter: %s" % strnext_time)
			# Continue next iteration
			continue

runTask(MySQLBackup, hour=10)
九、Hive数据仓库整合

1、配置MySQL作为Hive的远程元数据库:
在mysql中创建一个用户:

create user 'hive' identified by '123456';
   grant all privileges on *.* to 'hive'@'%' with grant option;
FLUSH PRIVILEGES; 
在本地配置文件上修改:

<property>
	 <name>javax.jdo.option.ConnectionURL</name>
	 <value>jdbc:mysql://slave1:3306/hive?createDatabaseIfNotExist=true</value>
	 <description>JDBC connect string for a JDBC metastore</description>
	</property>

	<property>
	 <name>javax.jdo.option.ConnectionPassword</name>
	 <value>123456</value>
	 <description>password to use against metastore database</description>
	</property>

2、从HDFS中直接导入数据到Hive表中:
创建空表:

create table Log(dat string,tim string,client_IP string,server_IP string,status string,Btype string) row format delimited fields terminated by '\t';
从HDFS中导入数据:

load data inpath '/output/part-r-00000' overwrite into table Log;

十、利用SQL进行简单的数据统计
1、查询本次收集了哪些天的数据,每天的浏览量有多少条?
   select dat,count(dat) as count from log group by dat;

2004-12-13 12599 
2004-12-14 1890
2004-12-15 12571
2004-12-16 2089
2004-12-17 12185
2004-12-18 2941
2004-12-19 11767
2004-12-20 2445
2004-12-21 11790
2004-12-22 2314
2004-12-23 11604
2004-12-24 1852
2004-12-25 12558
2004-12-26 1379
2004-12-27 13250
2004-12-28 1673
2004-12-29 12712
2004-12-30 1163
2004-12-31 13054
2005-01-01 1176
2005-01-02 13464
2005-01-03 908
2005-01-04 13364
2005-01-05 2082
2005-01-06 12302
2005-01-07 3335
2005-01-08 10853
2005-01-09 1260
2005-01-10 13458
2005-01-11 1624
2005-01-12 12952

2、每天访问的独立IP数量:
select dat,count(distinct(client_IP)) from Log group by dat;

2004-12-13 217
2004-12-14 41
2004-12-15 235
2004-12-16 57
2004-12-17 220
2004-12-18 72
2004-12-19 213
2004-12-20 57
2004-12-21 254
2004-12-22 57
2004-12-23 246
2004-12-24 54
2004-12-25 220
2004-12-26 45
2004-12-27 229
2004-12-28 49
2004-12-29 250
2004-12-30 40
2004-12-31 216
2005-01-01 40
2005-01-02 209
2005-01-03 36
2005-01-04 223
2005-01-05 52
2005-01-06 226
2005-01-07 70
2005-01-08 208
2005-01-09 37
2005-01-10 208
2005-01-11 38
2005-01-12 256


3、查询出现各种状态以及数据条数:
select status,count(status) from Log group by status;


200 94975
206 114
207 59
302 144
304 128762
403 39
404 4486
405 9
406 2
500 24

4、访问主要的原页面以及条数(考虑条数限制):
select orignHtml,count(orignHtml) a from Log group by orignHtml having  a>500 order by a Desc;
+--------------------------------------------------------------+------+
| orignHtml                                                    | a    |
+--------------------------------------------------------------+------+
| /index.asp                                                   | 6686 |
| /all.css                                                     | 6282 |
| /news/newsweb/call_news_top.asp                              | 6160 |
| /images/head.jpg                                             | 5015 |
| /images/index_r2_c4.jpg                                      | 4985 |
| /images/index_r2_c3.jpg                                      | 4984 |
| /images/index_r2_c1.jpg                                      | 4981 |
| /images/index_r2_c20.jpg                                     | 4978 |
| /images/index_r2_c18.jpg                                     | 4977 |
| /images/index_r2_c22.jpg                                     | 4975 |
| /images/44_r3_c2.jpg                                         | 4974 |
| /images/index_r2_c12.jpg                                     | 4973 |
| /images/spacer.gif                                           | 4973 |
| /images/index_r2_c14.jpg                                     | 4970 |
| /images/index_r2_c15.jpg                                     | 4969 |
| /images/44_r7_c2.jpg                                         | 4969 |
| /images/index_r2_c7.jpg                                      | 4969 |
| /images/index_r3_c1.jpg                                      | 4968 |
| /images/index_r2_c13.jpg                                     | 4968 |
| /images/index_r3_c6.jpg                                      | 4966 |
| /images/44_r1_c1.jpg                                         | 4965 |
| /images/44_r4_c2.jpg                                         | 4962 |
| /images/44_r2_c1.jpg                                         | 4959 |
| /images/xinwentiao.jpg                                       | 4955 |
| /images/44_r2_c2.jpg                                         | 4954 |
| /images/44_r6_c2.jpg                                         | 4953 |
| /images/44_r5_c2.jpg                                         | 4953 |
| /images/zuotiao1.jpg                                         | 4939 |
| /images/44_r11_c1.jpg                                        | 4927 |
| /images/44_r2_c4.jpg                                         | 4923 |
| /images/111_r2_c3.jpg                                        | 4878 |
| /images/111_r1_c1.jpg                                        | 4876 |
| /images/111_r1_c2.jpg                                        | 4876 |
| /images/login.gif                                            | 4876 |
| /images/zoutiao.jpg                                          | 4875 |
| /images/111_r1_c4.jpg                                        | 4872 |
| /images/111_r3_c1.jpg                                        | 4870 |
| /images/111_r4_c1.jpg                                        | 4867 |
| /images/zoutiao3.jpg                                         | 4867 |
| /news/inc/default.css                                        | 1428 |
| /News/newstemplate/template/6.jpg                            |  997 |
| /News/newstemplate/template/9.jpg                            |  995 |
| /News/newstemplate/template/8.jpg                            |  995 |
| /pop/newyear.htm                                             |  697 |
| /news/newshtml/schoolNews/7.jpg                              |  677 |
| /News/newstemplate/template/News/newstemplate/template/5.jpg |  647 |
| /news/newshtml/insideInform/index.asp                        |  622 |
| /news/newshtml/insideInform/4.jpg                            |  612 |
| /news/newsweb/call_notimenews.asp                            |  598 |
| /News/newstemplate/template/3.jpg                            |  589 |
| /News/newstemplate/template/2.jpg                            |  589 |
| /News/newstemplate/template/5.jpg                            |  564 |
| /news/newshtml/insideInform/7.jpg                            |  503 |
+--------------------------------------------------------------+------+


5、查找爬虫的记录
select date, Btype from Log where Btype like '%http://%' or '%spider%';
...................
....................
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |
| 2005-01-05 | Baiduspider+(+http://www.baidu.com/search/spider.htm)     |  
640 rows in set

6、查找客户端IP和IP的条数---如何与全国IP表对照求出访问地址?
select client_IP,count(client_IP) from Log group by client_IP; 
................
............................
| 61.235.74.120   |                5 |
| 61.235.74.184   |                3 |
| 61.235.74.24    |               41 |
| 61.235.74.49    |               40 |
| 61.235.80.177   |               99 |
| 61.240.64.75    |                1 |
| 61.241.132.196  |                4 |
| 61.241.132.228  |                3 |
| 61.48.106.24    |                1 |
| 61.50.142.28    |               86 |
| 61.51.110.148   |               39 |
| 61.51.131.179   |               22 |
| 61.51.227.171   |                1 |
| 61.55.0.92      |                1 |
| 61.55.182.254   |                1 |
+-----------------+------------------+
2234 rows in set (0.58 sec)


7、查看访问时间段分布:(没有列的时段都为0)
select count(time) from Log where time like '00%'; 
+-------------+
| count(time) |
+-------------+
|      136147 |
+-------------+
select count(time) from Log where time like '01%';
+-------------+
| count(time) |
+-------------+
|       47739 |
+-------------+
select count(time) from Log where time like '02%'; 
+-------------+
| count(time) |
+-------------+
|       12055 |
+-------------+
select count(time) from Log where time like '03%'; 
+-------------+
| count(time) |
+-------------+
|        4542 |
+-------------+
select count(time) from Log where time like '20%'; 
+-------------+
| count(time) |
+-------------+
|        7807 |
+-------------+
select count(time) from Log where time like '21%'; 
+-------------+
| count(time) |
+-------------+
|        4088 |
+-------------+
select count(time) from Log where time like '22%'; 
+-------------+
| count(time) |
+-------------+
|        4270 |
+-------------+
select count(time) from Log where time like '23%'; 
+-------------+
| count(time) |
+-------------+
|       11966 |
+-------------+

有兴趣的可以关注DataAnswer大数据!http://www.dataanswer.top





快速打开体积巨大的日志文件阅读软件 特别使用查看体积比较大的txt文件、数据库的日志文件,且针对查到重要信息会以指定颜色突出显示,便于快速查找问题! 立即下载

相关推荐

网络调试和分析工具 Proxyman Premium

它支持MacOS、iOS和iPadOS等操作系统,提供丰富的功能,如查看和编辑HTTP/HTTPS请求和响应、设置断点、过滤请求等。Proxyman Premium还支持WebSocket、GraphQL和gRPC等现代网络协议调试,并通过直观且图形化的操作界面,使用户能高效地监控和操纵网络数据流。此外,它还具备多种高级功能,如WebSocket支持、DNS欺骗、自定义SSL证书等,为开发人员提供极大的便利。同时,由于软件版本更新和界面调整,上述步骤可能会有所变化,建议您参考最新版本的官方文档进行操作。

llhf688的博客 2001

处理nacos、tomcat、nginx日志增长过快问题(logrotate可以处理所有日志清理问题)

系统是这么实现按天执行的。crontab会每天定时执行​​/etc/cron.daily​​​目录下的脚本,而这个目录下有个文件叫​​logrotate​​。/path/to/tomcat/logs/catalina.out 是Tomcat日志文件的路径。无需运行logrotate,在系统的/etc/cron.daily/logrotate默认配置中,已经设定为每天执行一次。这样,每天凌晨 1 点,find 命令将搜索 access_log 目录中修改时间超过 2 天的文件,并将其删除。

qq_27361945的博客 2572

什么是PON(无源光纤网络)、PON的发展及演进

全球知名媒体Omdia在光纤和铜缆接入设备预测报告中对2022年2月的预测显示,PON设备端口收入预计在2020年至2027年期间以12.3%的年复合增长率增长,到2027年将达到163亿美元,远高于2020年的82亿美元。 此前,Omdia有份报告称,在3月份举行的美国OFC展会中,众多 CSP 正在顺利部署 XGS PON(10G 对称),其他 CSP 专注于基于 GPON 的低速 FTTH 服务。另外关于25G PON 和 50G PON 之间的争论仍在继续,而Omdia 认为 25G PON 和 5

4930

日志大了,怎么办?用我的日志切割脚本

分享一个脚本,它配合linux系统的crontab任务,对nginx自动日志切割和清理,分别作用于ACCESS和ERROR的日志。 特点: 1、功能丰富 应有的功能中,不仅支持按天切割,而且支持通过通过设置文件大小作切割。 2、通用 通用于nginx、tengine,通过简单改进也能有好的支持切割清理httpd、lightd等其他Web server 日志。 3

lincaiyun的专栏 512

【模型转换】将.mindir文件转换成.ms文件(Windows篇)

首先需要在MindSpore中训练好并经过评估可用的模型,可以以标准格式(例如onnx, mindir等)导出,得到.mindir模型文件(例如lenet.mindir)。为了将模型部署到自定义应用中,还需要将其转换为更为紧凑和高效的ms格式模型,用于在MindSpore-Lite环境中推理,这可以通过MindSpore Lite提供的模型转换工具converter_lite完成。

qq_42962847的博客 1425

# 多用户 JupyterHub 配置教程(通用 Linux 服务器版)

以上即是通用 Linux 服务器上的多用户 JupyterHub 实战配置。从安装认证与 Spawner 选择自动创建系统用户到反代与运维,覆盖了小团队到中等规模的主流场景。根据团队增长与合规要求,你可以进一步引入、统一身份源(LDAP/OAuth2/Keycloak)与资源配额治理,平滑演进到企业级部署。

数字化老司机 1289

大数据解决方案:实时日志处理系统架构及整体思路

1.实时日志处理系统架构及整体思路   整个系统分为三层:收集(Agent)层,汇总(Collector)层和处理层。 其中Agent层采用flume收集日志,每个机器部署一个进程,负责对单机的日志收集工作; Collector层flume部署在后端服务器上,负责接收Agent层发送的日志,汇总并决定最终流向; 对于单个日志文件的服务器,flume采用传统的source-channe...

KamRoseLee的博客 8953

详细指南:如何在TI C2000基于C28x的微控制器上部署FreeRTOS_C语言实现

FreeRTOS是一个小型、开源、实时的嵌入式操作系统内核。它为多种微控制器和处理器提供了支持,包括ARM、AVR、MSP430和PIC等。小型和轻量级:适合资源受限的嵌入式系统。实时性:可以满足严格的实时要求。多任务支持:支持多任务并发执行。内存管理:提供了多种内存管理策略。模块化设计:用户可以根据需要选择所需的功能模块。TI C2000系列微控制器是专为实时控制应用设计的。高性能C28x核:提供了高速的浮点运算能力。丰富的外设:包括PWM、ADC、DAC、通信接口等。低功耗。

qq_38334677的博客 1606

Flume + Kafka 学习梳理

Flume1,flume 下分source,channel,sink 。 2,source 扮演生产者,给flume生产各种数据。本次采集数据用exec执行tail -F进行日志输出。还支持其他信息输出,见官方文档 3,channel 类似于中间站,平衡source 与 sink 之间的压力 4,sink 扮演消费者,从channel本次采用kafka。# download Flume FR

xq123joes的博客 418

工业级4~20mA转0~3V信号调理电路原理图设计,已量产(电流传感器)

在工业现场,4~20mA 电流信号是模拟量传输的 “老熟人”—— 抗干扰强、能跑长距离,但嵌入式 MCU 的 ADC 一般只认电压信号。最近做项目时,我设计了一款能覆盖 0~25mA(含超量程冗余)、线性输出 0~3V 的调理电路,经过现场调试挺稳定,分享下细节。

不脱发的程序猿 527

996引擎 - 读写变量性能测试

单轮100万次读写,取3轮平均耗时(毫秒),有效读取率均为100%,数值越小性能越优。

灵台方寸山斜月三星洞 244

Kafka,Mq和Redis作为消息队列使用时的差异有哪些

kafka是个日志处理缓冲组件,在大数据信息处理中使用。和传统的消息队列相比较简化了队列结构和功能,以流形式处理存储(持久化)消息(主要是日志)。日志数据量巨大,处理组件一般会处理不过来,所以作为缓冲曾的kafka,支持巨大吞吐量。为了防止信息都是,其消息被消防后不直接丢弃,要多存储一段时间,等过期时间过了才丢弃。这是mq和redis不能具备的。主要特点入下:巨型存储量: 支持TB甚至PB级别数...

weixin_33782386的博客 292

太阳敏感器:卫星姿态控制的“指南针

在卫星姿态控制系统中,太阳敏感器(Sun Sensor) 是至关重要的光学姿态敏感器之一。它通过探测太阳光的方向,为卫星提供关键的姿态参考信息,确保卫星能够正确调整自身方位,维持稳定的对日定向,保障能源供应和任务执行。

ScilogyHunter的博客 1731

ELK企业日志分析系统

Logstash:就像各地的柜台职员和运钞车。负责从各个来源(ATM、柜台、网上银行)收集货币(数据),进行清点、辨别真伪、分类整理(解析和转换),然后运送到总行金库。:就是银行的巨型、高科技、超高效的金库和归档系统。安全存储所有货币(数据),建立极其精细的索引。需要查询时,能在一瞬间从海量库存中精准找到任何一笔交易记录。Kibana:则是银行的数据分析和监控中心的大屏幕。

weixin_73616238的博客 288

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

47.ELK企业日志分析系统

ELK企业日志分析系统是一套开源的集中式日志管理解决方案,由Elasticsearch、Logstash和Kibana三大组件构成。Elasticsearch负责分布式存储和快速检索日志数据,Logstash用于日志收集、过滤和传输,Kibana提供可视化界面展示分析结果。该系统通过标准化流程处理日志:集中采集(Beats)→格式化处理(Logstash)→索引存储(Elasticsearch)→可视化展示(Kibana),有效解决了多服务器日志分散管理、检索效率低下等问题。典型应用场景包括实时监控Apac

专注云计算 667

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Kafka学习笔记-基本概念与安装部署

    Kafka是Linkedin开源的消息系统,它主要用于日志处理的分布式消息队列,处理活跃的流式数据。活跃的流式数据在网站应用中非常常见,这些数据包括网站的pv、用户行为(登录、浏览、点击、分享、喜欢等),搜索内容以及系统运行日志(CPU、内存、磁盘、网络、系统及进程状态)等。这些数据通常以日志的形式记录下来,然后每隔一段时间进行一次统计处理。传统的日志分析系统提供了一种离线处理日志信息的可...

PURSUE ONE PIECE 1215

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

AI SDK 应用数据备份方案:从备份对象分层到恢复演练的 5 个检查点

AI SDK 是 Vercel 团队维护的 TypeScript AI 应用工具包(Next.js 同一团队出品),负责模型调用、消息编排、工具与 Agent 执行。但它本身不存储你的业务数据——会话记录、上传文件、配置和密钥都存在你应用层。本文按“先确认备份对象 → 再分层 → 最后演练”的顺序,给出一份可直接落地的 AI SDK 数据备份与恢复检查清单。 ## 先确认三件事,再谈备份频率

gitblog_00267的博客 910

Go适合做什么?为何这么多人偏爱Go语言?

腾讯作为国内的大公司,还是敢于尝试的,尤其是Docker容器化这一块,他们在15年已经做了docker万台规模的实践,具体可以参考http://www.infoq.com/cn/articles/tencent-millions-scale-docker-application-practice。Go拥有强大的编译检查、严格的编码规范和完整的软件生命周期工具,具有很强的稳定性,稳定压倒一切。之所以写正确的并发、容错和可扩展的程序如此之难,是因为我们用了错误的工具和错误的抽象,Go可以说这一块做的相当简单。

m0_67390969的博客 1985

Kafka 总结

Kafka是一种高吞吐量的分布式、发布订阅消息系统。它可以处理消费者规模网站的所有的动作流数据。 Kafka是基于zookeeper协调的分布式消息系统,它最大的特性就是可以实时的处理大量数据以满足各种需求场景:比如基于Hadoop的批处理系统、低延迟的实时系统、storm/Spark流式处理引擎,web/Nginx日志、访问日志、消息服务等等。 1. Kafka特性 - ...

…… 398

01.ELK企业日志分析系统

ELK企业日志分析系统是一个由Elasticsearch、Logstash和Kibana组成的开源日志管理平台。Elasticsearch负责分布式存储和快速检索日志数据,Logstash用于收集、过滤和传输日志,Kibana提供可视化界面展示分析结果。该系统通过集中化管理日志,解决了传统分散式日志查询效率低下的问题,支持实时监控、故障排查和性能分析。核心流程为:应用服务器→Logstash采集→Elasticsearch存储→Kibana展示,实现了从日志收集到可视化分析的全链路处理。

weixin_63989592的博客 360

ELK企业日志分析系统-blog

首先,一个简单的类比来帮助你理解它们之间的关系:Logstash就像是各地的柜台职员和运钞车。它负责从各个来源(ATM、柜台、网上银行)收集货币(数据),进行清点、辨别真伪、分类整理(解析和转换),然后运送到总行金库。就是银行的巨型、高科技、超高效的金库和归档系统。它不仅安全地存储所有货币(数据),还建立了一套极其精细的索引。当需要查询时,它能在一瞬间从海量库存中精准地找到任何一张钞票或任何一笔交易记录。Kibana则是银行的数据分析和监控中心的大屏幕。

ZJ294003765的博客 380

LangFlow支持正则表达式节点,实现智能文本清洗

LangFlow新增正则表达式节点,支持无需编码的智能文本清洗与结构化提取,提升AI工作流中数据预处理效率,适用于脱敏、过滤等场景,推动规则与模型融合的混合智能架构。

weixin_29903713的博客 770
上一篇: R使用总结
下一篇: 拉勾网大数据相关岗位数据爬虫分析
JavaChaoCo
博客等级 码龄12年 67粉丝 36原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值