Repository navigation
The answer of course is "it depends". Factors include how much memory each box has, how many days you want to store meta data for, how fast the disks are, what percentage of the traffic is HTTP, the average transfer rate of all the interfaces, if the sessions are long lived or short lived, how fast response times should be for operators, how many operators are querying at the same time, etc.
A rough guideline for NODES is 1/3 * Number_of_Gigabit_Interfaces * Number_of_Days_of_History. If you have large machines then you can run multiple nodes per MACHINE.
The good news is it is easy to add new nodes in the future, so feel free to start with less nodes. As a temporary fix to capacity problems you can reduce the number of days of meta data that are stored. Just use the elastic head interface to delete the oldest sessions-* index.
Make sure you set up the db/daily.sh script to run once a day, during off peak. This script optimizes the previous days data and deletes the oldest data.
If queries are too slow then the easiest fix is to add additional elasticsearch nodes. You should also use the bigdesk http://moloches-machine:9200/_plugin/bigdesk/ and watch the heap memory graph, if it is approaching the max it is time to add more nodes or reduce the number of days being stored.
Elasticsearch doesn't do well if Java hits a OutOfMemory condition. If you ever have one you should immediate delete the oldest sessions-* index, update the daily.sh script to delete more often, and restart the elasticsearch cluster. Then you should order more machines. :)
- Use the same elasticsearch.yml file on the new nodes, no changes are usually required
- After starting the new elasticsearch nodes make sure they show up in bigdesk, if they don't show up check the logs and firewall issues
- Run the "db/db.pl upgrade" script
Turning on replication will consume twice the disk space on the nodes and increase the network bandwidth between nodes, so make sure you actually need replication.
To fix future days
- Edit the db/db.pl file and change the number_of_replicas from 0 to 1
- Run the "db/db.pl upgrade" script
Make sure all the nodes are actually running by checking bigdesk. Before starting to scream, make sure to wait at least 5-10 minutes after restarting before giving up. The most likely cause is the _state directory is missing for various shards. If you can live without the ENTIRE day that isn't going green the easiest solution is to use elastic head to just delete the day, the sessions-* index. http://moloches-machine:9200/_plugin/head/
If you want to try and recover the rest of the day then you need
- Find the machines with the missing index
- Check to see if the shard even exists (For example shard 4 on 120715 would live in /disk1/data/Moloch/nodes/0/indices/sessions-120715/4)
- If that directory is missing you need to create it by copying a empty version of the same directory from a temporary elastic search instance.
Need to check disk IO (iostat -xm 5) and CPU utilization/interrupts
- If using RAID 5 make sure you have write cache enabled on the RAID card
- Adaptec Example: arcconf SETCACHE 1 LOGICALDRIVE 1 WBB
- Make sure you use taskset to give moloch-capture its own CPU
- Check that the CPU you are giving moloch-capture isn't handling lots of interrupts (cat /proc/interrupts)
- Make sure other processes aren't using the same CPU as moloch-capture
- For ifdrop's increase the ring buffer using ethtool -g to view maximum and ethtool -G to set
Think of the 'moloch-capture' binary much like you would 'tcpdump'. 'moloch-capture' can listen to live network interface(s), or read from historic packet capture files.
- ${moloch_dir}/bin/moloch-capture -c [config_file] -r [pcap_file]
See ${moloch_dir}/bin/moloch-capture --help for more info
Click on the owl
- The source and destination ips are each counted, so the map should total twice the number of sessions
- Currently elasticsearch only has accurate counts up to 2 billion uniques
- Some countries aren't shown, but can still be searched using their ISO-3