• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » How To Process Server Log in Hadoop, Pig : Free IBM Analytics Demo Cloud

By Abhishek Ghosh July 20, 2017 11:02 pm Updated on September 17, 2017

How To Process Server Log in Hadoop, Pig : Free IBM Analytics Demo Cloud

Advertisement

In our previously published guides, we talked about installing Hadoop, installing Pig on own server. We also talked about free IBM Analytics Demo Cloud with needed softwares pre-installed, ready to use. Here is basic example with commands to show how to process server log in Hadoop, Pig can be done using free IBM Analytics Demo Cloud. This guide can be followed by even who never used Hadoop or Pig. We collected a script for the easy work. We only can not supply our server log to you as IP address collected by our server is sensitive data and may be prohibited to share in EU countries to protect privacy of our readers. You need to collect Apache web server access log from somewhere to really follow this guide.

 

How To Process Server Log in Hadoop, Pig

 

First, SSH to IBM Analytics Demo Cloud. Then wget your access log file in your desired location, for us location is ~ aka $HOME aka where you’ll be after login via SSH. In our example, the access log file’s name is access.log.1.

In case you are on SSH of your server, then use CLI FTP commands to upload (commands are under the sub header “Transfer FTP Files Directly From One Server to Another : Major Methods With Command Line”) the log to IBM Analytics Demo Cloud instance.

Advertisement

---

First we are feeding the data to Hadoop with this command :

Vim
1
hadoop fs -put access.log.1

If you face error, append location where diskX is disk number like disk2, USERNAME is like admin1234 (which IBM Analytics Demo Cloud provided you to SSH) :

Vim
1
hadoop fs -put access.log.1 /diskX/home/USERNAME/

If you run this command :

Vim
1
hadoop fs -ls -R

You’ll get output like this where you’ll find your thing listed :

Vim
1
2
drwx------+  - USERNAME USERNAME          0 2017-07-20 17:04 .staging
-rw-rw----+  3 USERNAME USERNAME  12183708 2017-07-20 16:33 access.log.1

Now we will create a script named script.pig at the same location with this content :

Vim
1
2
3
4
5
6
7
8
9
DEFINE ApacheCommonLogLoader org.apache.pig.piggybank.storage.apachelog.CommonLogLoader();
 
logs = LOAD '/path/to/USERNAMER/access.log.1' USING ApacheCommonLogLoader AS (addr: chararray, logname: chararray, user: chararray, time: chararray, method: chararray, uri: chararray, proto: chararray, status: int, bytes: int);
 
addrs = GROUP logs BY addr;
 
counts = FOREACH addrs GENERATE flatten($0), COUNT($1) as count;
 
DUMP counts;

Change /path/to/USERNAMER/access.log.1 in the above example to real path and save the file. Now run this command :

Vim
1
locate piggybank.jar

You will get a list of paths. At the bottom of the list, there will be entries like :

Vim
1
2
3
4
5
...
/usr/ibmpacks/bigsheets/5.4/libext/piggybank.jar
/usr/iop/4.1.0.0/hive/lib/piggybank.jar
/usr/iop/4.1.0.0/pig/piggybank.jar
/usr/iop/4.1.0.0/pig/lib/piggybank.jar

We will use that /usr/iop/4.1.0.0/pig/piggybank.jar path. Run :

Vim
1
pig

You will get MySQL like interface :

Vim
1
grunt>

Run this command there :

Vim
1
REGISTER '/usr/iop/4.1.0.0/pig/piggybank.jar';

To exit the interface, run :

Vim
1
quit

Now run :

Vim
1
pig -x local script.pig

With the script, you’ll get output of list of IP like this :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
...
(97.88.119.105,1)
(103.73.224.177,2)
(112.134.38.209,12)
(112.215.240.56,1)
(112.76.230.153,1)
(115.64.142.113,1)
(117.202.230.80,1)
(118.163.69.237,1)
(118.71.254.244,1)
(120.188.87.203,2)
...

How To Process Server Log in Hadoop, Pig - Free IBM Analytics Demo Cloud

Notice the above syntax – IP followed by number of times separated by comma. That is what was intended to show you a basic demo.

Tagged With IBM Analytics Demo Cloud , how to stop process in pig hadoop , pig hive , Raspberry Pi Car PC System
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How To Process Server Log in Hadoop, Pig : Free IBM Analytics Demo Cloud

  • How To Process Healthcare Data in Hadoop, Pig (IBM Demo Cloud)

    Here is Basic Commends Showing How To Process Healthcare Data in Hadoop, Pig Using IBM Demo Cloud. Unlike server log, healthcare data lacks universal format.

  • Install Apache Hadoop on Ubuntu on Single Cloud Server Instance

    Here is How Install Apache Hadoop on Ubuntu on Single Cloud Server Instance in Stand-Alone Mode With Minimum System Requirement and Commands.

  • Join/Merge Multiple Log Files For Big Data Analysis

    Here Are The Ways To Join/Merge Multiple Log Files For Big Data Analysis, Store Them To OpenStack Based Cloud Storage And Delete Old Files.

  • Advantages & Disadvantages of Using IBM Big Data Analytics On Cloud

    This article namely Advantages & Disadvantages of Using IBM Big Data Analytics On Cloud is like a case study which deals with the big data analytics tools from one of the largest IT corporations in the world – IBM.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • How to Install Appwrite as a Backend ServerJune 8, 2023
  • What is Application Lifecycle ManagementJune 8, 2023
  • How to Add Auto Anchor to WordPress HeadingsJune 7, 2023
  • Self-Hosted Fonts vs. Cloud-Hosted FontsJune 7, 2023
  • How to Restrict Certain Posts or Categories In WordPress by CountryJune 6, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT