ELK(数据批量导入、查询)

ELK 是一个实时分布式的日志分析平台
   ELK 是一整套的解决方案
   (E)lasticsearch  --  数据库
   (L)ogstash        --  收集日志、标准化的程序
   (K)ibana            --  图形的展示工具

[root@kibana ~]#

gzip -d '/root/桌面/shakespeare.json.gz'

gzip -d shakespeare.json.gz

curl -XPOST  http://192.168.6.10:9200/_bulk  @shakespeare.json

curl -XPOST  http://192.168.6.13:9200/_bulk  @shakespeare.json

curl -X "POST" "http://192.168.6.13:9200/_bulk" --data-binary @shakespeare.json

curl -X "GET" "http://192.168.6.12:9200/oo/xx/1"

curl -X "POST" "http://192.168.6.13:9200/oo/xx/_bulk" --data-binary @accounts.json

gzip -d accounts.json.gz 

 curl -X "POST" "http://192.168.6.13:9200/oo/xx/_bulk" --data-binary   @accounts.json

 gzip -d logs.jsonl.gz 

 curl -X "POST" "http://192.168.6.13:9200/_bulk" --data-binary  logs.jsonl 

 curl -X "POST" "http://192.168.6.13:9200/_bulk" --data-binary @logs.jsonl

分片规则:

//批量查询命令:

[root@kibana ~]# curl -XGET 'http://192.168.6.11:9200/_mget?pretty' -d '{

> "docs":[

> {

> "_index": "logstash-2015.05.20",

> "_type": "log",

> "_id": "AWTo25KYfhBMhz8MklNp"

> },

> {

> "_index": "shakespeare",

> "_type": "act",

> "_id": "645"

> },

> {

> "_index": "logstash-2015.05.18",

> "_type": "log",

> "_id": "AWTo25KPfhBMhz8Mkk-D"

> }

>     ]

> }'

{

  "docs" : [ {

    "_index" : "logstash-2015.05.20",

    "_type" : "log",

    "_id" : "AWTo25KYfhBMhz8MklNp",

    "_version" : 1,

    "found" : true,

    "_source" : {

      "@timestamp" : "2015-05-20T09:30:13.637Z",

      "ip" : "199.204.154.92",

      "extension" : "jpg",

      "response" : "200",

      "geo" : {

        "coordinates" : {

          "lat" : 45.58872222,

          "lon" : -122.5975

        },

        "src" : "PL",

        "dest" : "US",

        "srcdest" : "PL:US"

      },

      "@tags" : [ "success", "info" ],

      "utc_time" : "2015-05-20T09:30:13.637Z",

      "referer" : "http://twitter.com/warning/john-s-bull",

      "agent" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)",

      "clientip" : "199.204.154.92",

      "bytes" : 6505,

      "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",

      "request" : "/uploads/carlos-i-noriega.jpg",

      "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/carlos-i-noriega.jpg",

      "@message" : "199.204.154.92 - - [2015-05-20T09:30:13.637Z] \"GET /uploads/carlos-i-noriega.jpg HTTP/1.1\" 200 6505 \"-\" \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\"",

      "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",

      "xss" : "<script>console.log(\"xss\")</script>",

      "headings" : [ "<h3>oleg-kononenko</h5>", "http://nytimes.com/success/viktor-patsayev" ],

      "links" : [ "[email protected]", "http://twitter.com/info/donald-thomas", "www.www.slate.com" ],

      "relatedContent" : [ {

        "url" : "http://www.laweekly.com/news/top-of-the-dome-4-dia-de-los-muertos-2368091",

        "og:type" : "article",

        "og:title" : "Top of the Dome 4: Dia de Los Muertos",

        "og:description" : "The Crewest Gallery downtown held their fourth annual Day of the Dead exhibit with more than 100 ceramic skulls painted, decorated, reassembled and scul...",

        "og:url" : "http://www.laweekly.com/news/top-of-the-dome-4-dia-de-los-muertos-2368091",

        "article:published_time" : "2007-11-13T11:14:00-08:00",

        "article:modified_time" : "2014-10-28T15:00:02-07:00",

        "article:section" : "News",

        "article:tag" : "Culture and Lifestyle",

        "og:image" : "http://images1.laweekly.com/imager/top-of-the-dome-4-dia-de-los-muertos/u/original/2430651/_mg_7008small.jpg",

        "og:image:height" : "320",

        "og:image:width" : "480",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Top of the Dome 4: Dia de Los Muertos",

        "twitter:description" : "The Crewest Gallery downtown held their fourth annual Day of the Dead exhibit with more than 100 ceramic skulls painted, decorated, reassembled and scul...",

        "twitter:card" : "summary",

        "twitter:image" : "http://images1.laweekly.com/imager/top-of-the-dome-4-dia-de-los-muertos/u/original/2430651/_mg_7008small.jpg",

        "twitter:site" : "@laweekly"

      }, {

        "url" : "http://www.laweekly.com/arts/thinking-bluer-2373351",

        "og:type" : "article",

        "og:title" : "Thinking Bluer",

        "og:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",

        "og:url" : "http://www.laweekly.com/arts/thinking-bluer-2373351",

        "article:published_time" : "2006-06-08T18:06:54-07:00",

        "article:modified_time" : "2014-11-25T19:52:51-08:00",

        "article:section" : "Arts",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Thinking Bluer",

        "twitter:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",

        "twitter:card" : "summary",

        "twitter:site" : "@laweekly"

      }, {

        "url" : "http://www.laweekly.com/arts/just-another-night-on-the-strip-2373147",

        "og:type" : "article",

        "og:title" : "Just Another Night On The Strip",

        "og:description" : "Costume contest at the Key Club Monday Night Havent been back to Metal Skool's Monday mash since I used to deejay the VIP room, and thankfully nothing's...",

        "og:url" : "http://www.laweekly.com/arts/just-another-night-on-the-strip-2373147",

        "article:published_time" : "2007-10-31T10:57:33-07:00",

        "article:modified_time" : "2014-11-25T19:43:46-08:00",

        "article:section" : "Arts",

        "og:image" : "http://images1.laweekly.com/imager/just-another-night-on-the-strip/u/original/2441270/hal.jpg",

        "og:image:height" : "254",

        "og:image:width" : "384",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Just Another Night On The Strip",

        "twitter:description" : "Costume contest at the Key Club Monday Night Havent been back to Metal Skool's Monday mash since I used to deejay the VIP room, and thankfully nothing's...",

        "twitter:card" : "summary",

        "twitter:image" : "http://images1.laweekly.com/imager/just-another-night-on-the-strip/u/original/2441270/hal.jpg",

        "twitter:site" : "@laweekly"

      }, {

        "url" : "http://www.laweekly.com/news/pellicano-rebooted-2395620",

        "og:type" : "article",

        "og:title" : "Pellicano Rebooted",

        "og:description" : "“I was the coder, the implementer. The client was the designer.” So says coder-implementer Kevin Kachikian, private eye Anthony Pellicano&rs...",

        "og:url" : "http://www.laweekly.com/news/pellicano-rebooted-2395620",

        "article:published_time" : "2008-04-23T23:13:39-07:00",

        "article:modified_time" : "2014-11-26T17:45:26-08:00",

        "article:section" : "News",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Pellicano Rebooted",

        "twitter:description" : "“I was the coder, the implementer. The client was the designer.” So says coder-implementer Kevin Kachikian, private eye Anthony Pellicano&rs...",

        "twitter:card" : "summary",

        "twitter:site" : "@laweekly"

      }, {

        "url" : "http://www.laweekly.com/music/shows-and-tickets-coming-up-2411617",

        "og:type" : "article",

        "og:title" : "Shows and Tickets Coming Up",

        "og:description" : "Ryan Adams - Royce Hall, UCLA, Jan. 30 and Bridges Auditorium, Claremont, Jan. 22. Both shows on sale Saturday Avenged Sevenfold, Atreyu, Suicidal Tende...",

        "og:url" : "http://www.laweekly.com/music/shows-and-tickets-coming-up-2411617",

        "article:published_time" : "2007-11-30T11:20:51-08:00",

        "article:modified_time" : "2014-11-27T10:29:24-08:00",

        "article:section" : "Music",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Shows and Tickets Coming Up",

        "twitter:description" : "Ryan Adams - Royce Hall, UCLA, Jan. 30 and Bridges Auditorium, Claremont, Jan. 22. Both shows on sale Saturday Avenged Sevenfold, Atreyu, Suicidal Tende...",

        "twitter:card" : "summary",

        "twitter:site" : "@laweekly"

      } ],

      "machine" : {

        "os" : "win xp",

        "ram" : 21474836480

      },

      "@version" : "1"

    }

  }, {

    "_index" : "shakespeare",

    "_type" : "act",

    "_id" : "645",

    "_version" : 1,

    "found" : true,

    "_source" : {

      "line_id" : 646,

      "play_name" : "Henry IV",

      "speech_number" : 54,

      "line_number" : "",

      "speaker" : "HOTSPUR",

      "text_entry" : "ACT II"

    }

  }, {

    "_index" : "logstash-2015.05.18",

    "_type" : "log",

    "_id" : "AWTo25KPfhBMhz8Mkk-D",

    "_version" : 1,

    "found" : true,

    "_source" : {

      "@timestamp" : "2015-05-18T17:07:04.417Z",

      "ip" : "196.94.74.175",

      "extension" : "jpg",

      "response" : "200",

      "geo" : {

        "coordinates" : {

          "lat" : 42.88355556,

          "lon" : -88.59743056

        },

        "src" : "IN",

        "dest" : "CN",

        "srcdest" : "IN:CN"

      },

      "@tags" : [ "success", "info" ],

      "utc_time" : "2015-05-18T17:07:04.417Z",

      "referer" : "http://www.slate.com/success/ilan-ramon",

      "agent" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)",

      "clientip" : "196.94.74.175",

      "bytes" : 8701,

      "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",

      "request" : "/uploads/takao-doi.jpg",

      "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/takao-doi.jpg",

      "@message" : "196.94.74.175 - - [2015-05-18T17:07:04.417Z] \"GET /uploads/takao-doi.jpg HTTP/1.1\" 200 8701 \"-\" \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\"",

      "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",

      "xss" : "<script>console.log(\"xss\")</script>",

      "headings" : [ "<h3>michael-j-bloomfield</h5>", "http://twitter.com/success/anatoli-levchenko" ],

      "links" : [ "[email protected]", "http://www.slate.com/info/apollo-16", "www.twitter.com" ],

      "relatedContent" : [ {

        "url" : "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",

        "og:type" : "article",

        "og:title" : "Jay Electronica: Much Better Than His Name Would Suggest",

        "og:description" : "You may not know who Jay Electronica is yet, but I'm willing to bet that you would had he chosen a better name. Jay Electronica does not sound like the ...",

        "og:url" : "http://www.laweekly.com/music/jay-electronica-much-better-than-his-name-would-suggest-2412364",

        "article:published_time" : "2008-04-04T16:00:00-07:00",

        "article:modified_time" : "2014-11-27T08:01:03-08:00",

        "article:section" : "Music",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Jay Electronica: Much Better Than His Name Would Suggest",

        "twitter:description" : "You may not know who Jay Electronica is yet, but I'm willing to bet that you would had he chosen a better name. Jay Electronica does not sound like the ...",

        "twitter:card" : "summary",

        "twitter:site" : "@laweekly"

      }, {

        "url" : "http://www.laweekly.com/arts/outside-of-the-box-2371657",

        "og:type" : "article",

        "og:title" : "Outside of the Box",

        "og:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",

        "og:url" : "http://www.laweekly.com/arts/outside-of-the-box-2371657",

        "article:published_time" : "2005-10-25T16:10:25-07:00",

        "article:modified_time" : "2014-11-25T18:31:39-08:00",

        "article:section" : "Arts",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Outside of the Box",

        "twitter:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",

        "twitter:card" : "summary",

        "twitter:site" : "@laweekly"

      }, {

        "url" : "http://www.laweekly.com/news/pellicano-rebooted-2395620",

        "og:type" : "article",

        "og:title" : "Pellicano Rebooted",

        "og:description" : "“I was the coder, the implementer. The client was the designer.” So says coder-implementer Kevin Kachikian, private eye Anthony Pellicano&rs...",

        "og:url" : "http://www.laweekly.com/news/pellicano-rebooted-2395620",

        "article:published_time" : "2008-04-23T23:13:39-07:00",

        "article:modified_time" : "2014-11-26T17:45:26-08:00",

        "article:section" : "News",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Pellicano Rebooted",

        "twitter:description" : "“I was the coder, the implementer. The client was the designer.” So says coder-implementer Kevin Kachikian, private eye Anthony Pellicano&rs...",

        "twitter:card" : "summary",

        "twitter:site" : "@laweekly"

      }, {

        "url" : "http://www.laweekly.com/news/gorilla-in-east-hollywood-2368109",

        "og:type" : "article",

        "og:title" : "Gorilla in East Hollywood",

        "og:description" : "This is visible on the south side of Melrose (I lost my notes. I don't know what E/W street this on. Beverly?) if you're heading west through East Holly...",

        "og:url" : "http://www.laweekly.com/news/gorilla-in-east-hollywood-2368109",

        "article:published_time" : "2007-12-04T07:10:37-08:00",

        "article:modified_time" : "2014-10-28T15:00:05-07:00",

        "article:section" : "News",

        "og:image" : "http://IMAGES1.laweekly.com/imager/gorilla-in-east-hollywood/u/original/2430788/img_2444.jpg",

        "og:image:height" : "360",

        "og:image:width" : "480",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Gorilla in East Hollywood",

        "twitter:description" : "This is visible on the south side of Melrose (I lost my notes. I don't know what E/W street this on. Beverly?) if you're heading west through East Holly...",

        "twitter:card" : "summary",

        "twitter:image" : "http://IMAGES1.laweekly.com/imager/gorilla-in-east-hollywood/u/original/2430788/img_2444.jpg",

        "twitter:site" : "@laweekly"

      }, {

        "url" : "http://www.laweekly.com/arts/fierce-2370226",

        "og:type" : "article",

        "og:title" : "Fierce!",

        "og:description" : "For those of you wondering if I ever made it to the Cavalli collection's opening day at H&M in the Beverly Center, the answer is no. Just to be safe, I ...",

        "og:url" : "http://www.laweekly.com/arts/fierce-2370226",

        "article:published_time" : "2007-11-12T23:38:48-08:00",

        "article:modified_time" : "2014-11-25T17:13:49-08:00",

        "article:section" : "Arts",

        "og:image" : "http://images1.laweekly.com/imager/fierce/u/original/2431935/zombie.jpg",

        "og:image:height" : "255",

        "og:image:width" : "384",

        "og:site_name" : "LA Weekly",

        "twitter:title" : "Fierce!",

        "twitter:description" : "For those of you wondering if I ever made it to the Cavalli collection's opening day at H&M in the Beverly Center, the answer is no. Just to be safe, I ...",

        "twitter:card" : "summary",

        "twitter:image" : "http://images1.laweekly.com/imager/fierce/u/original/2431935/zombie.jpg",

        "twitter:site" : "@laweekly"

      } ],

      "machine" : {

        "os" : "win xp",

        "ram" : 32212254720

      },

      "@version" : "1"

    }

  } ]

}

 

 

猜你喜欢

转载自blog.csdn.net/weixin_40018205/article/details/81280199
今日推荐