geoip

nginx编译记

别说谁变了你拦得住时间么 提交于 2020-03-23 12:03:40
/** * @author Sun Yongyue * @comment 有点久了,入门级的东东,今天翻到就放出来吧 */ nginx编译记 -- with pcre/zlib/openssl preinstall 不想让nginx和pcre、openssl、zlib等一起安装(事实上一起做静态编译的话,nginx的性能会好一点,不过这个地方只是个人环境,不用考虑)。 开始尝试编译时,使用一些资料上的with-pcre、with-zlib、with-openssl参数。后来一直不成功,修改N次后无果,google之。查看很多资料之后,锁定以下几篇。 [1] 发现objs/autoconf.err里边提示md5.h找不到,google到nginx的作者回答的一个类似问题: > > The --with-openssl= option should point to OpenSSL sources, but not > > to inlcudes and binary libraries. > OK thx for the answer. As your OpenSSL is set in non-standard place (I have just tested building on Debian with standard /usr/include/openssl/md5.h)

Converting GeoLite2 data for use with xtables geoip

蹲街弑〆低调 提交于 2020-03-23 08:20:13
问题 My apologies if this has been covered here or elsewhere. I read the postings back to 2016. My debian system stopped updating the xtables geoip database. On investigation it developed that this is because Maxmind dropped support for legacy GeoIP databases. I have got as far as installing and configuring Maxmind's geoipupdate program for the GeoLite2 database and scheduling it weekly in crontab. At this point I am stumped. geoipupdate returns a .mmdb database. This is not usable by the debian

nginx日志查看goaccess安装使用

谁说胖子不能爱 提交于 2020-03-09 18:17:34
nginx日志查看goaccess安装使用 准备工作: Linux CentOs 6.5 Nginx 1.8 1. 安装前准备 切换到 /usr/local 使用如下指令: wget http://tar.goaccess.io/goaccess-1.0.1.tar.gz tar -xzvf goaccess-1.0.1.tar.gz cd goaccess-1.0.1/ ./configure --enable-geoip --enable-utf8 make make install 开始使用 1.1 下载源文件 使用如下执行:wget http://tar.goaccess.io/goaccess-1.0.1.tar.gz 1.2 解压缩 使用如下执行:tar -xzvf goaccess-1.0.1.tar.gz 1.3 进入目录中 cd goaccess-1.0.1/ 1.4 准备编译检查配置 ./configure --enable-geoip --enable-utf8 出现以下截图: 1.4.1 安装 GeoIp 执行 yum install GeoIp 出现异常错误信息:No package GeoIp available. 如何操作呢?根据参考网址获得应该使用:yum install GeoIP GeoIP-devel GeoIP-data 1.5 make 1

ELK 7.6分析 Nginx 日志 并启用x-pack权限认证

寵の児 提交于 2020-03-04 19:01:01
安装之前先附上Kibana配置效果图 Nginx 服务器日志的log_format格式如下: log_format main_cookie '$remote_addr\t$host\t$time_local\t$status\t$request_method\t$uri\t$query_string\t$body_bytes_sent\t$http_referer\t$http_user_ag ent\t$bytes_sent\t$request_time\t$upstream_response_time\t$aoji_uuid\t$aoji_session_uuid'; 软件包如下: 1、elasticsearch 7.6 安装及配置 elasticsearch-7.6.0-linux-x86_64.tar.gz 解压到 /data/ 目录 tar xf elasticsearch-7.6.0-linux-x86_64.tar.gz && mv elasticsearch-7.6.0 /data/ 配置文件所在目录:/data/elasticsearch-7.6.0/config 修改配置文件elasticsearch.yml node.name: es-1 network.host: 172.31.0.14 http.port: 9200 xpack.security

Laravel 创建自己的 Facade

青春壹個敷衍的年華 提交于 2020-03-04 15:59:51
博客原文: Laravel 创建自己的 Facade 前言 laravel 提供了一个灵活的模式,那就是 facade 。框架内部的 DB、Auth、File 等功能也有相关的 facade 实现。那么,该如何写自己的 facade 呢? Facade 是什么? 首先,facade 并不是 laravel 独有的东西,它就是设计模式中的外观模式(Facade)。 当然,这里就不长篇大论去讨论外观模式的定义了。这篇文章写的很不错 : 设计模式(九)外观模式Facade(结构型) 。 那么,laravel 的 facade 做了什么? 同样的, laravel 实现了外观模式的开关功能,并且使用魔术方法 __callstatic 实现了静态方式调用、动态创建对象的功能。参考 ( 官方文档 ) 当然你可能觉得这些概念很抽象,都什么玩意。那么其实简单的讲,laravel 的 facade 就是将某些功能封装成工具类,而且能以静态方式调用工具类的方法。 建立自己的 facade 首先、以 laravel 5.1 框架,我之前写过的 Geoip facade 为例,说一下怎么去建立自己的 facade。 下载 geoip 扩展 geoip 是一个可以更具 IP 获取国家、地域、城市信息的 PHP 扩展,基于 maxmind 数据库。 github 在此 。 首先,为 laravel 添加

goaccess geoip 测试

不问归期 提交于 2020-03-03 09:42:44
goaccess 是一个很不错的日志实时统计分析工具,我们可以用来方便的分析nginx apcahe iis 等的日志信息 对于geoip 的支持是需要源码编译的,所以基于官方docker 镜像添加了geoip 的支持 dockerfile # Builds a goaccess image from the current working directory: FROM alpine:edge WORKDIR /goaccess RUN wget https://tar.goaccess.io/goaccess-1.3.tar.gz RUN tar -xzvf goaccess-1.3.tar.gz RUN cd goaccess-1.3/ ARG build_deps="build-base ncurses-dev autoconf automake git gettext-dev" ARG runtime_deps="tini ncurses libintl gettext openssl-dev" RUN apk update && \ apk add -u $runtime_deps $build_deps geoip-dev && \ wget -O goaccess-1.3.tar.gz https://tar.goaccess.io/goaccess-1.3.tar

GeoIP的使用

流过昼夜 提交于 2020-03-03 09:42:27
GeoIP介绍: 什么是GepIP ? 所谓GeoIP,就是通过来访者的IP, 定位他的经纬度,国家/地区,省市,甚至街道等位置信息。这里面的技术不算难题,关键在于有个精准 的数据库。有了准确的数据源就奇货可居赚点小钱,可是发扬合作精神,集体贡献众人享用是我们追求的。 GeoIP如 何使用? 首先我们需要数据信息,所以先获取一个免费的数据库: GeoIP.dat.gz ,接着解压得到:GeoIP.dat, 然后就是对数据文件的按需操作,这边范例使用的是PHP。 GeoIP + PHP的使用 方法一: 下载 GeoIP 的 PHP 文件geoip.inc,保存为 geoip.inc.php php使用代码 include("geoip.inc.php"); // 打开数据文件 $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD); // 获取国家代码 $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); echo "Your country code is: $country_code "; // 获取国家名称 $country_name = geoip_country_name_by_addr($gi, $_SERVER['REMOTE_ADDR']);

spark streaming 使用geoIP解析IP

馋奶兔 提交于 2020-03-03 09:41:54
1、首先将GEOIP放到服务器上,如,/opt/db/geo/GeoLite2-City.mmdb 2、新建scala sbt工程,测试是否可以顺利解析 import java.io.Fileimport java.net.InetAddressimport com.maxmind.db.CHMCacheimport com.maxmind.geoip2.DatabaseReaderimport org.json4s.DefaultFormats/** * Created by zxh on 2016/7/17. */object test { implicit val formats = DefaultFormats def main(args: Array[String]): Unit = { val url = "F:\\Code\\OpenSource\\Data\\spark-sbt\\src\\main\\resources\\GeoLite2-City.mmdb" // val url2 = "/opt/db/geo/GeoLite2-City.mmdb" val geoDB = new File(url); geoDB.exists() val geoIPResolver = new DatabaseReader.Builder(geoDB).withCache

spark geoip

落爺英雄遲暮 提交于 2020-03-03 09:41:29
import java.io.File import scala.io.Source import com.sanoma.cda.geoip.MaxMindIpGeo import com.sanoma.cda.geo.Point import java.io.PrintWriter val geoIp = MaxMindIpGeo("/data/elas-input/GeoIP2-City.mmdb", 1000,synchronized = true) def iter_dir(srcDir:String,dstDir:String): Unit ={ val files = (new File(srcDir)).listFiles().filter(_.isFile) for( item <- files){ println(item.getName) val dstname = item.getName val out = new PrintWriter(s"""${dstDir}/${dstname}""") for(line <- Source.fromFile(item).getLines()){ val it = line.split("\t") val geo = geoIp.getLocation(it(0)) if(geo.isEmpty){ out

ELK-7.0安装部署收集展示

假装没事ソ 提交于 2020-01-29 22:16:11
前言 什么是ELK? 通俗来讲,ELK是由Elasticsearch、Logstash、Kibana 三个开源软件的组成的一个组合体,这三个软件当中,每个软件用于完成不同的功能,ELK 又称为ELK stack,官方域名为stactic.co,ELK stack的主要优点有如下几个: 处理方式灵活: elasticsearch是实时全文索引,具有强大的搜索功能 配置相对简单:elasticsearch全部使用JSON 接口,logstash使用模块配置,kibana的配置文件部分更简单。 检索性能高效:基于优秀的设计,虽然每次查询都是实时,但是也可以达到百亿级数据的查询秒级响应。 集群线性扩展:elasticsearch和logstash都可以灵活线性扩展 前端操作绚丽:kibana的前端设计比较绚丽,而且操作简单 什么是Elasticsearch: 是一个高度可扩展的开源全文搜索和分析引擎,它可实现数据的实时全文搜索搜索、支持分布式可实现高可用、提供API接口,可以处理大规模日志数据,比如Nginx、Tomcat、系统日志等功能 什么是Logstash: 可以通过插件实现日志收集和转发,支持日志过滤,支持普通log、自定义json格式的日志解析。 什么是kibana: 主要是通过接口调用elasticsearch的数据,并进行前端数据可视化的展现。 一